If you are working with one of the BSD variants of UNIX then viewing the entire command line is easy - pass the "ww" (wide wide) arguments to the ps command, which will display the entire command line. If you are using a SYSV variant of UNIX, like Solaris, then that version of ps doesn't provide any "extra wide" options.
For example, using the standard SYSV ps on Solaris will give you something like the following:
rmaldon@sun1> ps -ef | grep rmaldon
rmaldon 13703 1 0 17:40:11 pts/11 0:33 /opt/IBM/WebSphere/AppServer/java/bin/java -XX:MaxPermSize=256m -Dwas.status.so
which is only a fraction of the full command line that was used to start the process.
How can you find out the full Java command line on a SYSV platform? You can compile a BSD version of ps for your SYSV platform courtesy of the GNU shellutils package. Or, on Solaris, because Solaris started out as a BSD variant many moons ago they still bundle some BSD tools, including ps, in the /usr/ucb directory. So, using the /usr/ucb/ps on Solaris will give you something like:
rmaldon@sun1> /usr/ucb/ps -auxww | grep rmaldon
rmaldon 13703 9.0 2.4300728187352 pts/11 S 17:40:11 0:32
/opt/IBM/WebSphere/AppServer/java/bin/java -XX:MaxPermSize=256m -Dwas.status.socket=45169
-Xbootclasspath/p:/opt/IBM/WebSphere/AppServer/java/jre/lib/ext/ibmorb.jar:/opt/IBM/WebSphere/AppServer/java/jre/lib/ext/ibmext.jar -classpath /opt/IBM/WebSphere/AppServer/properties:/opt/IBM/WebSphere/AppServer/lib/bootstrap.jar:/opt/IBM/WebSphere/AppServer/lib/j2ee.jar:/opt/IBM/WebSphere/AppServer/lib/lmproxy.jar:/opt/IBM/WebSphere/AppServer/lib/urlprotocols.jar
-Xms50m -Xmx256m -Dws.ext.dirs=/opt/IBM/WebSphere/AppServer/java/lib:/opt/IBM/WebSphere/AppServer/classes:/opt/IBM/WebSphere/AppServer/lib:/opt/IBM/WebSphere/AppServer/installedChannels:/opt/IBM/WebSphere/AppServer/lib/ext:/opt/IBM/WebSphere/AppServer/web/help:/opt/IBM/WebSphere/AppServer/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime
-Dderby.system.home=/opt/IBM/WebSphere/AppServer/derby
-Dcom.ibm.itp.location=/opt/IBM/WebSphere/AppServer/bin
-Djava.util.logging.configureByServer=true -Dibm.websphere.preload.classes=true
-Dwas.install.root=/opt/IBM/WebSphere/AppServer
-Djava.util.logging.manager=com.ibm.ws.bootstrap.WsLogManager
-Ddb2j.system.home=/opt/IBM/WebSphere/AppServer/cloudscape
-Djava.security.auth.login.config=/opt/IBM/WebSphere/AppServer/properties/wsjaas.conf
-Djava.security.policy=/opt/IBM/WebSphere/AppServer/properties/server.policy
com.ibm.ws.bootstrap.WSLauncher com.ibm.ws.runtime.WsServer sun1 server1
19 comments:
Thank you, thank you, thank you!
Debugging some problems on a Solaris box from a qmail installation I set up ages ago, I couldn't find the full command lines for the tcpserver commands that have been running for years (uptime 880 days and counting). /usr/ucb/ps -auxww to the rescue.
Cool. It's saved my butt a few times as well. Glad you found this tip useful.
Odd. /usr/ucb/ps -auxww has always worked for me in the past, but today I'm on some Solaris box and can't get it to work.
I wonder if the box I'm on has this option compiled out of it for security (obscurity) reasons.
bash-3.00$ uname -a
SunOS evilbank 5.10 Generic_125100-05 sun4u sparc SUNW,Sun-Fire-V890
brian, a couple of things come to mind:
1. If the UNIX user you're running ps as is different from the UNIX user under which the particular process is running then UNIX permissions can prevent you from seeing the full command line.
2. If Sun disabled wide listing for some reason then an alternative is to use the GNU version of ps. http://www.sunfreeware.com/ has pre-built GNU utils for Solaris. You can extract the ps binary from the psutils package.
Hey, thank you very much. I have been looking for a similar solution since months ago. Today I cheered up a little bit and tried again and found your post! I has been absolutely helpful to me. Thanks a lot for sharing this great solution. Gerardo Costilla geecox@gmail.com
Helped me, too. This is one command I always forget but I have enough information to ask, man page, or google. Thanks for your post.
whew! Thanks mate!
These days I use pargs to get the full details of a running process. You can also do 'pargs -e' to get the environment variables, including the directory the app was started from. With this, it makes it easy to restart about any process.
thanks buddy
Thank you very much
I'd spent few hours before found this solution.
Alexander Land
Thank you very much for this command. This has helped me out greatly as well.
Thanks. Saved the day...
Great! this command helped me as well :)
I will join the thanks party, Thanks
You can also use jinfo
Great, have been looking for something like this in forever!
Thank you, Robert, some Solaris admins think that ps -ef returns the full monty. I showed them this information.
Thanks! Saved me today!
Very usefull! Thank you
Post a Comment