Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»(Resolved) – /bin/rm: Argument list too long

    (Resolved) – /bin/rm: Argument list too long

    RahulBy RahulJuly 14, 20211 Min ReadUpdated:January 13, 2022

    One of the directories has millions of files, which is no more required. When trying to delete all files from that folder using the rm command, I got below error message:

    /bin/rm : Argument list too long

    If there are a large number of files in a single directory, Then the traditional rm command can not delete all files and ends with an error message Argument list too long.

    To resolve this issue and delete all files use xargs command-line utility with the find command.

    1. First change to the directory where all files exists:
      cd dir_contains_file 
      
    2. Then execute command to delete all files in current directory and its sub directories.
      WARNING – This will also delete files from subdirectories. Be careful with this command.

      find . -name '*' | xargs rm 
      

    That’s it. you will find all files are deleted now.

    command rm xargs
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install and Switch Desktop Environments in Ubuntu
    Next Article Linux ip Command and Examples

    Related Posts

    How to run “npm start” through docker

    2 Mins Read

    Filesystem Hierarchy Structure (FHS) in Linux

    Updated:July 1, 20222 Mins Read

    What is CPU? – Definition, Types and Parts

    3 Mins Read

    How to Install Ionic Framework on Ubuntu 22.04

    3 Mins Read

    What is the /etc/hosts file in Linux

    Updated:June 27, 20222 Mins Read

    Creating DMARC Record for Your Domain

    Updated:June 29, 20223 Mins Read

    2 Comments

    1. xteracrack on September 8, 2021 6:13 pm

      Tnks a lot, work great in Solaris 10

      Reply
    2. DeaDSouL on July 24, 2021 12:37 am

      find . -iname ‘*’ -exec rm ‘{}’ \;

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to run “npm start” through docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.