Monday, March 27, 2023
HomeJavaLearn how to show full command a Operating Course of in Linux...

Learn how to show full command a Operating Course of in Linux and Solaris? Instance

One of many issues with ps command, which is a well-liked device to search out any processes together with the grep command within the Solaris working system is that it would not present full command-line argument of course of. This implies in case you are doing grep on any textual content which seems on the tail finish of the lengthy command line, you’ll probably not in a position to seize that course of by utilizing ps and grep. That is harmful as a result of it could lead you to imagine that sure course of shouldn’t be working and you might restart it once more, regardless of its being working and solely since you did not discover the method.

That is fairly widespread whereas working Java processes in any UNIX working system e.g. Solaris, Linux, IBM AIX, and so forth as a result of Java course of often has an extended checklist of arguments like 
system properties, JVM choices, and identify of the primary class.

I’ve confronted this drawback fairly a number of instances even after utilizing ps -ef choice. Till now I’ve not discovered any compelling answer for this drawback which can work on all UNIX methods, aside from Solaris, which  I’m going to share with you guys.

So, my solely recommendation is to place the key phrase within the head of the lengthy command-line argument and attempt to hold the Java command line as small as potential

Additionally, want utilizing ps -auxww over ps -ef,  former higher show lengthy command line than later and you’ve got the next likelihood of capturing the method by utilizing grep with tail key phrases.

Solaris command to show lengthy arguments of working course of

Placing essential key phrases e.g. identify of your Java course of at first of argument checklist is Okay however what if you really want full command line argument of any course of in UNIX atmosphere? Positive there have to be some command which may give you full command line of a working course of, no? 

Nicely, I did not learn about it regardless of utilizing UNIX and Linux from very long time till not too long ago after I actually wanted full command line argument a Java course of which is taking most of CPU from that machine. I discovered the method id (PID) of that Java course of utilizing prstat command after which I attempted to see that course of utilizing ps command for that course of however did not see full command line. 
Few Google search reveals a command known as pargs which exhibits full command line of a course of if you recognize course of id (PID).  It is not a substitute of ps command however nonetheless a great device to see full command line of any course of in Solaris. 

Command to search out out course of which is utilizing excessive CPU

Right here is an instance of how you need to use prstat and pargs command in Solaris to discover a working course of and present its full checklist of argument.

[test@localhost] > prstat -scpu
 28525 take a look at      860M  615M sleep   59    0  80:35:02 3.5% java/833
 19681 take a look at      431M  361M cpu0    30    0   2:57:43 3.1% ksh/2

You possibly can see right here that our Java course of 28525 is utilizing 3.5% of CPU and it has 833 threads. Now we have to discover out full checklist of arguments handed to this course of from command line whereas beginning it. It would not matter whether it is began from a script or straight as a result of in UNIX, start-up script will probably be a unique course of than your Java utility.

Solaris command to point out an entire checklist of arguments of a working course of

Right here is the whole instance of pargs command in Solaris which takes course of id and shows the total checklist of argument which is used to run that course of. It is a useful gizmo to see full command with JVM choices used to begin a Java course of in Solaris

[test@localhost]> pargs 28525
pargs: Could not decide locale of goal course of.
pargs: Some strings will not be displayed correctly.
28525:  /decide/jdk1.6.0_22/bin/java -server -Dsun.rmi.dgc.cli
argv[0]: /decide/jdk1.6.0_22/bin/java -server -Dsun.rmi.dgc.cli
argv[1]: -server
argv[2]: -Dsun.rmi.dgc.shopper.gcInterval=3600000
argv[3]: -Dsun.rmi.dgc.server.gcInterval=3600000
argv[4]: -verbose:gc
argv[5]: -Xloggc:./logs/GC.log
argv[6]: -XX:+PrintGCTimeStamps
argv[7]: -verbose:gc
argv[8]: -Xloggc:./logs/GC.log
argv[9]: -XX:+PrintGCTimeStamps
argv[12]: -Xms2048M
argv[13]: -Xmx2048M
argv[14]: -cp

Bingo, now you may see that what argument has handed to course of with PID 28525. You possibly can see that first argument is Java executable itself. You could find out your JDK location in addition to Java model quantity e.g. right here JDK is situated at /decide partition and Java model is JDK 1.6.0_22

Subsequent, you may see the argument cross to JVM e.g. -server exhibits that its working on server mode. You may also see different rubbish assortment choices, startup and max reminiscence offered to server and it is classpath. I’ve not proven full classpath right here purposefully however if you run this command in Solaris by your self, you will notice all of the arguments handed to your Java course of.
How to see full argument list of a running process in Solaris

That is all on Learn how to present lengthy command line of a course of working on Solaris working system. It is a very helpful command to troubleshoot Java course of with lengthy checklist of arguments e.g. you may test what JVM parameters has been handed to your Java course of, worth of key configuration parameters and it’s also possible to discover how a lot most reminiscence is allotted to your Java utility.

Different Linux and UNIX Tutorials for Learners and Skilled

  • 10 examples of date command in Linux (examples)
  • Learn how to get an IP tackle from the hostname (command)
  • 10 examples of the xargs command in Linux (examples)
  • 5 Free Programs to study Linux for Learners (Free programs)
  • 10 examples of tar command in UNIX (examples)
  • 10 examples of reduce command in Linux (examples)
  • 10 examples of Vim in UNIX (examples)
  • 10 examples of lsof command in Linux (examples)
  • Learn how to create, replace and delete mushy hyperlink in UNIX (command)
  • 5 examples of kill command in Linux (examples)
  • 6 Free Programs to study Bash scripting in-depth (free programs)
  • 10 examples of chmod command in UNIX (examples)
  • 10 examples of curl command in Linux (examples)
  • 10 Books each Linux Energy consumer ought to learn (books)
  • 5 examples of kind command in Linux (examples)
  • 10 Finest Linux Programs for Programmers and Builders (Programs)

Thanks for studying this text thus far. Should you like this Linux and Solaris command  tutorial and examples, then please share it with your mates and colleagues.
In case you have any questions or suggestions, then please drop a notice. 



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments