Operating System - HP-UX
1832350 Members
2606 Online
110041 Solutions
New Discussion

Re: How to see the complete listing of a process using ps

 
Avinash_2
Occasional Contributor

How to see the complete listing of a process using ps

ps -ef command on hpux truncates the listing for a given process. If I want to see the complete command listing for a java process, i cannot do so using ps -ef.
In sun there is a alternative command "/usr/ucb/ps -auxwww" that gives the full listing for the command.
Can anyone please help me out with doing the same on hpux.
Thanks in advance.
6 REPLIES 6
Robert-Jan Goossens
Honored Contributor

Re: How to see the complete listing of a process using ps

Hi,

# UNIX95= ps -e -opid -o args

Regards,
Robert-Jan
Peter Godron
Honored Contributor

Re: How to see the complete listing of a process using ps

Avinash,
ps -efx > x.x
vi x.x
Regards
H.Merijn Brand (procura
Honored Contributor

Re: How to see the complete listing of a process using ps

ps -ealf

is what you can get. If it's truncated, you cannot get more. at least not on HP-UX with ps

you could dive into the /dev/mem space for that process to find the argc/argv, but by the time you found it, the process has ended

It's time HP-UX would support Linux' /proc system (optional) :)

perl's Proc::ProcessTable /might/ give you more:

Linux:
lt09:/home/merijn 116 > perl -MProc::ProcessTable -le'$p=Proc::ProcessTable->new;for(@{$p->table}){$_->pid == $$ and print $_->pid," ",$_->cmndline}'
8899 perl -MProc::ProcessTable -le$p=Proc::ProcessTable->new;for(@{$p->table}){$_->pid == $$ and print $_->pid," ",$_->cmndline}
lt09:/home/merijn 117 >

HP-UX 11.00 (see the truncation):
a5:/u/usr/merijn 101 > perl -MProc::ProcessTable -le'$p=Proc::ProcessTable->new;for(@{$p->table}){$_->pid == $$ and print $_->pid," ",$_->cmndline}'
15587 perl -MProc::ProcessTable -le$p=Proc::ProcessTable->new;for(
a5:/u/usr/merijn 102 >

HP-UX 11.11 (other truncation):
r3:/u/usr/merijn 101 > perl -MProc::ProcessTable -le'$p=Proc::ProcessTable->new;
for(@{$p->table}){$_->pid == $$ and print $_->pid," ",$_->cmndline}'
24860 perl -MProc::ProcessTable -le$p=Proc::ProcessTable->new;for(@{$
r3:/u/usr/merijn 102 >

HP-UX 10.20 (same as 11.00):
d3:/u/usr/merijn 103 > perl -MProc::ProcessTable -le'$p=Proc::ProcessTable->new;for(@{$p->table}){$_->pid == $$ and print $_->pid," ",$_->cmndline}'
667 perl -MProc::ProcessTable -le$p=Proc::ProcessTable->new;for(
d3:/u/usr/merijn 104 >

AIX 5.2 (no truncation):
i4:/u/usr/merijn 101 > perl -MProc::ProcessTable -le'$p=Proc::ProcessTable->new;for(@{$p->table}){$_->pid == $$ and print $_->pid," ",$_->cmndline}'
25332 perl -MProc::ProcessTable -le$p=Proc::ProcessTable->new;for(@{$p->table}){$_->pid == $$ and print $_->pid," ",$_->cmndline}
i4:/u/usr/merijn 102 >

AIX 4.3 (no truncation):
i2:/u/usr/merijn 101 > perl -MProc::ProcessTable -le'$p=Proc::ProcessTable->new;for(@{$p->table}){$_->pid == $$ and print $_->pid," ",$_->cmndline}'
27332 perl -MProc::ProcessTable -le$p=Proc::ProcessTable->new;for(@{$p->table}){$_->pid == $$ and print $_->pid," ",$_->cmndline}
i2:/u/usr/merijn 102 >

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Steve Steel
Honored Contributor

Re: How to see the complete listing of a process using ps

Hi

You can see a lot but from man ps


args The command line given when the process was
created. This column should be the last one
specified, if it is desired. Only a subset of the
command line is saved by the kernel; as much of
the command line will be displayed as is
available. The output in this column may contain
spaces. The default heading for this column is
COMMAND if -o is specified and CMD otherwise.




Thus for a long command forget it


export UNIX95=XPG4
ps -exH -o user,ruser -o pid,ppid -o args="Command_arguments_used_______________
________________________________________________________________________________
__________________________________________"


Steve Steel

If you want truly to understand something, try to change it. (Kurt Lewin)
Patrick Wallek
Honored Contributor

Re: How to see the complete listing of a process using ps

You can get a longer listing of the command with the '-x' option to ps. However, for 11.0 a patch is required to enable '-x'.
Amit Agarwal_1
Trusted Contributor

Re: How to see the complete listing of a process using ps

best option would be to use -x option

$ ps -efx

Please note that this option is not avaiable by default in 11.00, you can either install patch for this or you can enable XPG4 behavior by setting env variable UNIX95.

$ UNIX95=1 ps -e -o pid,args

To add spice, be aware that program that changes their name while calling exec will see that "command name without -x" is not same as the "basename of first argument of commmand line with -x".