I have about 17k files in a directory. When I run
ls directory, I have to wait for about 15-20 seconds before the results are displayed. On the other hand, when I run
ls directory | wc -l or
ls directory | grep .xyz, the results are displayed immediately.
Why does this happen and is there a way to fix this?