lls is lightweight ls. Using lls, you can get a list of files in a directory that contains a large number of files.
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 for more information.
$ 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.