Site icon IT Tutorial

bash: /bin/rm: Argument list too long

When Anydisk or mount point is full in linux, you need to delete files. You can get ” -bash: /bin/rm: Argument list too long ” error during remove files.

 

 

bash: /bin/rm: Argument list too long

 

You want to delete all audit files which are .aud extension like following.

[root@MehmetSalih audit]# rm -rf *aud 

-bash: /bin/rm: Argument list too long

 

 

Argument list too long

But you got ” -bash: /bin/rm: Argument list too long ” error, to solve this problem you can use following command.

 

[root@MehmetSalih audit]#  find . -name "*aud" -print | xargs rm -rf

 

 

 

You can change *aud extension to the *trc or *trm. You can delete all trc extension files like following if their argument list too long.

[root@MehmetSalih audit]#  find . -name "*trc" -print | xargs rm -rf

 

[root@MehmetSalih audit]#  find . -name "*trm" -print | xargs rm -rf

[root@MehmetSalih audit]#  find . -name "*.log" -print | xargs rm -rf

 

 

 

You can also use Following solutions to solve this problem.

find . -name "*aud" -delete 

find . -type f -name "FILE-TO-FIND" -exec rm -f {} \; 

find . -name "*aud" -print | xargs rm -rf

for file in *; do rm -f $file;done

or (if you want to delete also directories)

for file in *; do rm -rf $file;done

 

 

Do you want to learn Linux System Administration for Beginners, then Click this Link and read the articles.

Exit mobile version