Linux: /usr/bin/rm: Argument list too long

First navigate to folder where you want to delete files, do’t use “ls”, “ls -la” as it can take lot of time before it will show result, so just make sure your in correct directory before running this command as it will delete all files in that directory

find . -type f -exec rm -v {} \;

Command will find all files one by one and will delete it.

If you want to delete only specific files for example only .jpg files

find . -maxdepth 1 -name "*.jpg" -print0 | xargs -0 rm

It will search files with .jpg extension in current directory and will delete it one by one.

Leave a Reply

Your email address will not be published. Required fields are marked *