So you have a directory with millions of files, and ls just hangs ?
Use ls -1 -f to show the files immediately. To delete the files, if you want to remove ALL files in the current directory, use something like
ls -1 -f | xargs rm
After cleaning up very many unwanted files, you are likely to be left with a huge and sparse directory object. Three million files in one directory, for example, apart from taking up space in themselves, will likely push the directory object to occupy over 100 Mb of space. Continue reading