Gentoo Wiki


This page is a candidate for deletion 
Reason given: Stub with not context information.
If you disagree with its deletion, please explain why on its discussion page.
If you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Make sure no other pages link here and check the page's history before deleting.


Error: Argument list too long

The maximum length of the command line argument is limited to *128k* within the Linux kernel:

grep ARG_MAX /usr/include/linux/limits.h
#define ARG_MAX       131072    /* # bytes of args + environ for exec() */


This annoying limitation usually manifests itself when the rm command is being used to delete a huge directory of unwanted files. The shell fails to invoke the rm command altogether if the ARG_MAX limit is exceeded:

rm *
sh: /bin/rm: Argument list too long


A workaround is to use the find command to invoke the rm command with each argument individually:

find ./ -name '*' -exec rm {} \;


The limit affects the execve() kernel function, which is utilized by all other exec() functions (execl, execlp, execle, etc). The function works is by creating a 128K buffer at the top end of the memory space and copying the command line and environment for the new process into this space. The kernel then loads the new program into memory, sets its argv and envp pointers, and jumps to to program entry point. The "Argument list too long" error message is caused by the !E2BIG error code, being returned by the execve() function, when it is unable to fit the supplied argument list and environment into the 128K buffer.

Retrieved from ""

Last modified: Thu, 12 Jun 2008 10:14:00 +0000 Hits: 960