Argument list too long Linux Origin: Platform & cloud Last updated 13 Oct 2026

bash: /bin/rm: Argument list too long

A glob like * expanded to more file names than the kernel allows in one command (ARG_MAX), so the command never ran.

Exact message you may see Argument list too long/bin/rm: Argument list too long
Seen on: Linux

Meaning

The shell expands * before running rm/cp/mv. With hundreds of thousands of files the expanded arguments exceed the limit. Use find or xargs, which process files in batches.

Common causes

  • Glob matching a huge number of files (sessions, cache, logs)
  • Very long variable expanded into arguments

⚡ Quick fix

  1. Use find -delete
  2. Pipe to xargs in batches
  3. Delete the whole directory if appropriate

Detailed fix by platform

Linux

  1. bash
    find /var/lib/php/sessions -type f -name 'sess_*' -delete
    find . -name '*.log' -print0 | xargs -0 rm -f

How to diagnose

  1. Count — find dir -type f | wc -l
  2. Limit — getconf ARG_MAX

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

0x80070020 — 0x80070020: The process cannot access the file because it is being used by another process (Windows)0x800700200x80070570 — Error 0x80070570: The file or directory is corrupted and unreadable (Windows)0x80070570Access to the path is denied — System.UnauthorizedAccessException: Access to the path 'x' is denied (.NET)Access to the path is…command not found — bash: command not found (Linux)command not foundEEXIST — Error: EEXIST: file already exists, mkdir (Node.js)EEXISTEISDIR — Error: EISDIR: illegal operation on a directory, read (Node.js)EISDIRENOENT — Error: ENOENT: no such file or directory (Node.js)ENOENTENOTDIR — Error: ENOTDIR: not a directory (Node.js)ENOTDIRArgument …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.