Operating System - HP-UX
1833838 Members
2372 Online
110063 Solutions
New Discussion

executable name in ps command

 
Jit-Wee Lim
Occasional Contributor

executable name in ps command

Hi,

When I use ps command to look for a process, the process name returned in some cases are listed by its implied path.

example:
olympus!jl1521dv:~ [37]> ps -aefl | grep -v grep | grep ChkImmediate
1 S sbcdtest 8697 1 0 168 20 42ad9800 2129 597451c0 Mar 24 ? 0:15 ChkImmediate

In this example, ChkImmediate could be from any directories.

What I would like to do is to find out which directory ChkImmediate came from.

Any suggestions will greatly help.

Thanks.

JW
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: executable name in ps command

As root

find / -name ChkImmediate

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
H.Merijn Brand (procura
Honored Contributor

Re: executable name in ps command

Or use lsof

a5:/ 104 # ps
PID TTY TIME COMMAND
18814 ttyp1 0:00 tcsh
18850 ttyp1 0:00 ps
a5:/ 105 # lsof -p 18814
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
tcsh 18814 root cwd VDIR 64,0x3 8192 2 /
tcsh 18814 root txt VREG 64,0xb 425984 56 /pro/bin/tcsh
tcsh 18814 root mem VREG 64,0x7 40960 1766 /usr/lib/libnss_files.1
tcsh 18814 root mem VREG 64,0x7 24576 17843 /usr/lib/libdld.2
tcsh 18814 root mem VREG 64,0x7 1552384 15720 /usr/lib/libc.2
tcsh 18814 root mem VREG 64,0x7 188416 17841 /usr/lib/dld.sl
tcsh 18814 root mem VREG 64,0x8 532 3443 /var/spool/pwgr/status
tcsh 18814 root 15u VCHR 17,0x1 0t2021 1280 /dev/pty/ttyp1
tcsh 18814 root 16u VCHR 17,0x1 0t2021 1280 /dev/pty/ttyp1
tcsh 18814 root 17u VCHR 17,0x1 0t2021 1280 /dev/pty/ttyp1
tcsh 18814 root 18u VCHR 17,0x1 0t2021 1280 /dev/pty/ttyp1
tcsh 18814 root 19u VCHR 17,0x1 0t2021 1280 /dev/pty/ttyp1
a5:/ 106 #

as you can see in the third line of output, the location of the command is /pro/bin/tcsh

[ BTW this is much more reliable than the find command, since commands can change the name they appear under in ps ]

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Jeff Schussele
Honored Contributor

Re: executable name in ps command

Hi JW,

ps is only going to show the command as it was entered - for EX

command
./command
/full/path/to/command
etc.....

So however the command was called is how ps will display it.
NOTE: that sometimes the actual command string is so long a "normal" ps -ef command output will truncate it. In that case use -x in the ps command - for EX:
ps -efx
You should get the entire command then. This is especially useful when you want to see all the command line parameters.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!