Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)

like image 844
shaft Avatar asked Oct 19 '25 14:10

shaft


2 Answers

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.

like image 144
shaft Avatar answered Oct 21 '25 02:10

shaft


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.

like image 24
blafasel Avatar answered Oct 21 '25 03:10

blafasel