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

Hi,

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

 

 

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



  

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

Mehmet Salih Deveci

I am Founder of IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress mehmetsalih.deveci@outlook.com.-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  mehmetsalih.deveci@outlook.com a mail atabilirsiniz.

One thought on “Linux -bash: /bin/rm: Argument list too long

  • June 23, 2019 at 9:00 pm
    Permalink

    You say you are trying to remove “files” but the -r option will also remove the ./not_aud/ directory and all its contents. That might not be what some users want.

    Also note that if you have a file:

    ./somedir/somefile.aud

    And you run:

    % rm -rf *aud

    the file will NOT be removed, but if you run:

    % find . -name “*aud” -print | xargs rm -rf

    the file WILL be removed!

    Reply

Leave a Reply

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