diff --git a/README.md b/README.md index cdb5365..902dc07 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_374 TILs and counting..._ +_375 TILs and counting..._ --- @@ -324,6 +324,7 @@ _374 TILs and counting..._ - [Change Default Shell For A User](unix/change-default-shell-for-a-user.md) - [Check If A Port Is In Use](unix/check-if-a-port-is-in-use.md) - [Clear The Screen](unix/clear-the-screen.md) +- [Command Line Length Limitations](unix/command-line-length-limitations.md) - [Copying File Contents To System Paste Buffer](unix/copying-file-contents-to-system-paste-buffer.md) - [Create A File Descriptor with Process Substitution](unix/create-a-file-descriptor-with-process-substitution.md) - [Curling With Basic Auth Credentials](unix/curling-with-basic-auth-credentials.md) diff --git a/unix/command-line-length-limitations.md b/unix/command-line-length-limitations.md new file mode 100644 index 0000000..dc54a4e --- /dev/null +++ b/unix/command-line-length-limitations.md @@ -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/)