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.
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
- Use find -delete
- Pipe to xargs in batches
- Delete the whole directory if appropriate
Detailed fix by platform
Linux
- bash
find /var/lib/php/sessions -type f -name 'sess_*' -delete find . -name '*.log' -print0 | xargs -0 rm -f
How to diagnose
- Count — find dir -type f | wc -l
- 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:
Similar errors
Most viewed in Linux
Other ways to find it
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026