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!


A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

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.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.