Wednesday, July 28, 2010

commands: /usr/ucb/ps

/usr/bin/ps and /usr/ucb/ps are the same in that they are wrappers to call the platform specific ps. /usr/ucb/ps is the ("University of California, Berkeley") BSD ps & /usr/sbin/ps should be the SVR4 ps. If you compare the ps and UCB ps commands that are *really* run, you'll see they are different:









 # ls -l /usr/bin/sparcv9/ps /usr/ucb/sparcv9/ps
 -r-xr-xr-x   1 root     bin        38464 Jan 18  2003 /usr/bin/sparcv9/ps
 -r-sr-xr-x   1 root     sys        28592 Jan 18  2003 /usr/ucb/sparcv9/ps


It's there for historical reasons.  SunOS 4.x was based on BSD unix. Solaris 2.x (= SunOS 5.x) was based on SYSV, with a bunch of commands having different syntax and behavior. To ease the transition, the /usr/ucb directory was created to hold the incompatible BSD versions.
People who really wanted BSD could put /usr/ucb before /usr in their PATH. Trouble shooting web applications or such java type unix components can be very useful using the /usr/ucb/ps command. This is useful for some people who wants to know how an application actually got launched, which may include a long list of configuration parameters. Seeing the full command-line including all arguments is useful for configuration troubleshooting.

If you run:

 # /usr/ucb/ps -e

or

 # /usr/ucb/ps -axe 

(the -e flag) if you show really long output like you're doing, you can actually  see what environment variables are set for every process that's running. So, since you know the userid of the process from your ps output, you have a pretty good chance of knowing what environment variables are set in their shell.  Some could be from the script they're running, but mostly are just from the user's env.

Further system and performance information can also be presented using the following command:

 # /usr/ucb/ps -auxww

The w switch uses a wide output format,  that  is,  132  columns rather  than  80. If the option letter is repeated, that is, -ww, this  option  uses  arbitrarily wide output. This information is used to decide how much of long commands to print. 


No comments:

Post a Comment