shaft
shaft

Reputation: 2229

linux: ps truncates command line output

My goal is to get the command line args of a java process. I am running ps aux | grep java> out.log to see the full argument list. Problem is that it's truncated at approx 4k bytes. Java is invoked from a build tool (maven) so I don't have much influence on the arguments. Most of the long argument list is related to classpath entries. On the windows platform the argument list is approx 12Kb.

How can I see the full command line arguments in Linux even if they are longer than 4K? I am running on Linux Mint Petra. I've tried with the processes explorer but it also truncates (and it won't let my copy-paste the arguments)

Upvotes: 4

Views: 5559

Answers (4)

Jan
Jan

Reputation: 70

Just note for some, how are not able to use GUI tools. Another alternative is using of jinfo tool, included in JDK. Just be aware of, that you need to use same version of JDK as java, you are running (some time there is used JRE instead of java from JDK).

just use jinfo <pid>

Upvotes: -1

shaft
shaft

Reputation: 2229

Just found this explanation how-do-i-increase-the-proc-pid-cmdline-4096-byte-limit. It basically tells me that the linux kernel has a hard limit (unless I want to recompile it). The best solution for me was to run jconsole. This does the trick for me at least for java processes.

Upvotes: 5

morgano
morgano

Reputation: 17422

There is a hardcoded limit of 4k in the cmdline buffer in Linux, so there's not much you can do about it unless you feel like downloading the kernel's source and modify it to allow a bigger buffer.

As a workaround you could execute maven with the -X option for full debugging and using tee to write to standard output and also a file: mvn -X clean install | tee my_log_file.txt and then try to find the information you're looking for in my_log_file.txt

Upvotes: 2

blafasel
blafasel

Reputation: 1121

You can try

ps axwwo args

This shows all arguments that are stored in the process table.

But the right way would be to get more familiar with your build tool. If you master this maven gives you perfect control.

Upvotes: 2

Related Questions