1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-04 23:58:01 +00:00

Add Command Line Line Length Limitations as a unix til

This commit is contained in:
jbranchaud
2016-03-26 09:37:59 -05:00
parent 5d79373562
commit fda7f2085e
2 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
# Command Line Length Limitations
The other day I tried to run a remove command on the contents of a directory
with a **LOT** of files.
```
$ rm images/*
```
Instead of deleting the contents of the directory, the following message was
displayed:
```
/bin/rm: cannot execute [Argument list too long]
```
Bash wanted to expand the entire command before executing it. It was too
long. But what is too long?
It turns out that we can figure out the max length of commands with the
following command:
```
$ getconf ARG_MAX
```
For me, the result is `262144`.
[source
1](http://stackoverflow.com/questions/11289551/argument-list-too-long-error-for-rm-cp-mv-commands)
and [source
2](http://www.cyberciti.biz/faq/argument-list-too-long-error-solution/)