Operating System - HP-UX
1834081 Members
2247 Online
110063 Solutions
New Discussion

Re: long output for PS command

 
Adi_7
Frequent Advisor

long output for PS command

Hi all,
These commands print the PID of the process.
Linux:
ps -auwwwx | grep gravitixagent | grep -v grep|awk '{print $2}'

Solaris:
/usr/ucb/ps -auwwwx | grep gravitixagent | grep -v grep|awk '{print $2}'

HP : ??
I'm looking for the similar command in HP which gives the output beyond 80 characters.

Thanks.
4 REPLIES 4
Jeff Schussele
Honored Contributor

Re: long output for PS command

Hi Adi,

In 11i & up-to-date patched 11.0 you can use the -x parameter in a ps command to get more output....

ps -efx

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Robert A. Pierce
Frequent Advisor

Re: long output for PS command


Did you try

ps -ef

That can go more than 80 characters, with the command line . . .

but if you just want the PID, then

ps -ef | grep whatever | awk '{print $}'

will work.
Robert A. Pierce
Frequent Advisor

Re: long output for PS command

Adi,

Here are a couple of scripts I use that might be of interest:

$ cat $(which psgrep)
#!/sbin/sh
# psgrep - ps and grep in one step

print " UID PID PPID C STIME TTY TIME COMMAND"
ps -fade | grep $1 | grep -v grep
$



$ cat $(which awkc)
# awkc - print out one or more columns

p=\$$( echo $1 | sed 's/,/,\$/g' )
shift
eval "awk '{ print $p }'" $*
# eof
$

Hope this helps,

Rob Pierce
James R. Ferguson
Acclaimed Contributor

Re: long output for PS command

Hi:

Jeff is correct. You should have, or download and install:

For 11.0: PHCO_26274, PHKL_29434 & PHKL_26008

These add the '-x' option to 'ps' and enable the 'pstat(2)' interface to handle the kernel's extended storage (up to 1020 characters).

For 11.11, make sure you have patch PHCO_29042.

Regards!

...JRF...