Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My process cmd is very long because there are lots of arguments. Now I would like to check the full cmd. By using cat /proc/PROCESS_NUMBER/cmdline, the cmd is not fully shown. Is there any other way to see exactly full cmd in linux?

share|improve this question

migrated from Nov 16 '12 at 9:01

This question came from our site for professional and enthusiast programmers.

Have you tried ps -efwwww | grep <command name>? – jaume Nov 16 '12 at 12:09
Just tried. This will give the same commandline length as cat /proc/PROCESS_NUMBER/cmdline Thanks for let me know more about ps :-) – DeepNightTwo Nov 17 '12 at 15:26
up vote 2 down vote accepted

How long is your command line?

If it is in the megabyte range, you might perhaps recompile your kernel with a bigger ARG_MAX in your linux-3.*/include/linux/limits.h file. I put there

#define ARG_MAX  2097152    /* # bytes of args + environ for exec() */

(there might also be a way to set that limit dynamically, but I forgot how, and I could be wrong)

I do like big ARG_MAX limit because I occasionally use the **/*.c global expansion feature of zsh which is my interactive shell.

Don't put a huge value in ARG_MAX; I would guess that you want to have it less than 2% of your available RAM.

Notice that /proc/*/cmdline contains null bytes. You might translate them, see this.


if for whatever reason you cannot afford a large command line, find some way and convention to avoid having such a large amount of program arguments. For instance, you could modify the invoked program to read some things from a file or some other source (database?). For example, some Unix programs (e.g. GCC) accept @filename to read options from some file named filename.

share|improve this answer
This way looks cool~ But this host is a prod host and I have no rights to re-compile kernel. The commandline length is far from megabyte. It is about 10k at most. Is there a easy with less impact to host to do this? Thanks~ – DeepNightTwo Nov 17 '12 at 15:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.