Wednesday, May 9, 2012

ps -eo in HP-UX

If you try to run something like:

# ps -eo ppid,pid,comm

in HP-UX then you will get the following error:

# ps -eo ppid,pid,comm
ps: illegal option -- o
usage: ps [-edaxzflP] [-u ulist] [-g glist] [-p plist] [-t tlist] [-R prmgroup] [-Z psetidlist]

The ps command seems not to accept the -o option. To solve this issue you have to unset the UNIX95 variable before running the ps command with the -o option:

# UNIX95= ps -eo ppid,pid,comm

With the leading UNIX95 variable ps -eo shouldn't give any issues.