Linux: Cannot Delete Files from a Directory /bin/rm: Argument list too long

If you’re trying to delete files from a directory that have too many files and over sized then simply rm command will not work and you will get error /bin/rm: Argument list too long

root@hostname [~]# cd mydir
root@hostname [~]# rm -f *
-bash: /bin/rm: Argument list too long.

In this case following command will be handy instead of rm and is much faster too.

root@hostname [~]# find . -type f -delete

above command will delete all files from the directory you’re in.

Tags: , , , , , , , , , , , ,

Post a Comment