Wednesday, March 5, 2008

Listing long process names on UNIX

Sometimes (with the WebSphere java process, for example), the 'ps' command will truncate the name of a command, not allowing you to determine the actual process. This article tells you how you can increase the output of the command.

The 'ps' command flags on different flavors of UNIX is slightly different, but there is a set of flags that can be passed to the "appropriate" 'ps' command to give you an entire command name, its arguments, and even the environment variables set when the command was started. The flags are "eww" (with no preceding dash). These flags are supported by the BSD (Berkeley) implementation of 'ps'. /bin/ps on AIX supports these flags directly, so you can run:

ps eww [pid]

And it will give you a LONG listing of your processes, or details of a specific [pid]. On Solaris and others, however, you need to specify '/usr/ucb/ps', since /bin/ps doesn't support these flags. So on Solaris, you would run:

/usr/ucb/ps eww [pid]

(UCB = University of California, Berkeley). Other flavors of UNIX appear to be ore similar to the Solaris implementation.

No comments: