Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

Getting the command line of a running process in Linux is usually easy, just run the "ps -ef" command, but what if the command line used to start a process is very long? It gets a little more difficult. This is the problem I ran into recently when trying to get all the arguments used to start a WebLogic managed server. The ps command was only displaying the first 4096 characters of the command line.

The same 4096 character limit is present if you cat the /proc/<PID>/cmdline file for your process.
 Command
cat /proc/<PID>/cmdline


Luckily the JDK has a solution for us. The jinfo command can be used to extract the full command line (minus the executable path) for the JVM process...
 Command
jinfo 26295|grep "Command line:"|cut -c 16-


Nice and easy!



-i

Skip down to comments...
Hope you found this post useful...

...so please read on! I love writing articles that provide beneficial information, tips and examples to my readers. All information on my blog is provided free of charge and I encourage you to share it as you wish. There is a small favour I ask in return however - engage in comments below, provide feedback, and if you see mistakes let me know.

If you want to show additional support and help me pay for web hosting and domain name registration, donations, no matter how small, are always welcome!

Use of any information contained in this blog post/article is subject to this disclaimer.
 
comments powered by Disqus
Other posts you may like...