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.
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...
jinfo 26295|grep "Command line:"|cut -c 16-

Nice and easy!


Skip down to comments...
A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. If you spot something out of place, please do let me know.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
comments powered by Disqus
Other posts you may like...