-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
21 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
# lls | ||
# lls | ||
|
||
lls is lightweight ls. Using lls, you can get a list of files in a directory that contains a large number of files. | ||
|
||
## How? | ||
|
||
You allocate a buffer for the size of the directory, and then call the getdents64 system call directly. | ||
|
||
The larger the size of the directory, the more memory you will need. By running `ls -dl`, you will know how much memory to allocate in advance. | ||
|
||
See [this article](http://be-n.com/spw/you-can-list-a-million-files-in-a-directory-but-not-with-ls.html) for more information. | ||
|
||
## Usage | ||
|
||
```sh | ||
$ lls > output.txt | ||
|
||
$ lls / > output.txt | ||
``` | ||
|
||
If you want to reduce the memory usage, you can specify the `-buf-size` option. If the size you specify is smaller than the actual size needed, you will not get the full file list. |