When delete won't work

When you are trying to delete a large number of files in Linux, sometimes the rm command will fail with the error message “-bash: /bin/rm: Argument list too long”

This is due to a kernel limit, and the workaround is to use the “xargs” command to apply the delete command to a list of files. The find command bundles up the files, and xargs tells the rm command to delete them.

If you are in the directory you wish to delete files from, issue this command:

# find . -name ‘*’ | xargs rm
# find . -type f |xargs rm -f
# find . -type d | xargs rm -rf