Today I’ve decided to cleanup the hard drive on my Linux workstation and “surprisingly” found 8G of temporary files in one folder.

After quick review I’ve decided to erase them with rm command.

For my surprise when running the command:

/bin/rm *.tmp

I got following error message:

bash: /bin/rm: Argument list too long

Conclusion:Even rm command has his limits!

Solution: Get Plumber(Joking)
Actually only Pipe is needed.
By typing following command:

find . -name "*.tmp"|less

You will see list of the files and by replacing less with xargs /bin/rm those files will be erased. Can you skip previous step? Yes you can and it is not required, but you risk to erase a lot of data if you have syntax error.

find . -name "*.tmp"| xargs /bin/rm.

Depending on the number of files and your system speed after a while all files will be erased.

Done .

Share/Save/Bookmark

Comments

Leave a Reply