diff --git a/README.md b/README.md index 810a3dc..e46bdb6 100644 --- a/README.md +++ b/README.md @@ -1 +1,21 @@ -# lls \ No newline at end of file +# 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.