A backup script that runs on several Linux systems recently produced the following error:
ls: cannot access '/tmp/sortrq9hq8': No such file or directory
It happens every time the backup runs. Other than the above message, there seems to be no ill effect on the backup, which completes successfully. The ls command did not find a file that it expected to be there.
This article explains how the missing file was created by the Linux sort command as a temporary storage area, how error messages about these files are likely to crop up from time to time, how to reproduce the error, and some background about the behaviour of the sort command on Linux and Solaris. Continue reading →
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 →