News for hackers. Stuff that matters.
Re:One Billion Files: Scalability Limits in Linux File Syste... by lmm on Wednesday April 06, 2016 @09:35AM (#11438636)
Protip: if you just want to see what files are there use "echo *", it's much faster than ls.
Re:One Billion Files: Scalability Limits in Linux File Syste... by tyingq on Wednesday April 06, 2016 @10:33AM (#11438996)
Tested a few things. "ls -U" seems to be the fastest approach I could find. -U disables sorting.

  $ mkdir testdir && cd testdir # make 200k files
  $ perl -e 'for (1..200000) {open(FOO,">$_");close(FOO)}'

  $ time echo * >>/dev/null
  real	0m1.607s user 0m1.480s sys 0m0.128s
  $ time ls >> /dev/null
  real	0m1.458s user 0m1.324s sys 0m0.132s
  $ # globs
  $ time perl -e 'for (glob("*")) {print "$_\n"}' >>/dev/null
  real	0m0.679s user 0m0.404s sys 0m0.272s
  $ time find . -maxdepth 1 -print >> /dev/null
  real	0m0.239s user 0m0.128s sys 0m0.108s
  $ time ls -U >> /dev/null
  real	0m0.195s user 0m0.064s sys 0m0.132s
Re:One Billion Files: Scalability Limits in Linux File Syste... by MichaelBurge on Wednesday April 06, 2016 @10:00AM (#11438798)
It might be faster, but it won't work for large directories.

For large directories, I either use 'ls --color=never' or the example C program in 'man 2 getdents'.

Re:One Billion Files: Scalability Limits in Linux File Syste... by gnosek on Wednesday April 06, 2016 @10:49AM (#11439115)
ls -U avoids the default sort by name. Without -U you get all the names at once at the end of the directory scan. With the option you get them one by one (in some unspecified order) and can make sort of a progress bar for counting files in large directories:

    ls -U huge_dir | awk 'NR % 100000 == 0 { print NR } END { print NR }'
(prints the count every 100k files and the total at the end).
Re:One Billion Files: Scalability Limits in Linux File Syste... by sua_mae on Wednesday April 06, 2016 @10:58AM (#11439188)
/bin/ls do the trick to avoid all options on the alias.