1834118 Members
2598 Online
110064 Solutions
New Discussion

Re: ps

 
navin
Super Advisor

ps

hello all,
I need to know the option of the "ps" command that shows the full path of the command
thanks
Learning ...
6 REPLIES 6
James R. Ferguson
Acclaimed Contributor

Re: ps

Hi Navin:

What's reported by 'ps' is the command line as originally issued. This is available in the 'args' field output. It may or may not be a command with an absolute path.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: ps

Matti_Kurkela
Honored Contributor

Re: ps

If you already know that the "ps" command has the correct option, why don't you use the "man ps" command and read the man page to find the correct option?

You'll want one of the options listed under the sub-heading "Output Format Options". By reading through the descriptions of the available information columns, you'll want to display the "args" column instead of "comm".

But if the full path is not used in starting the command, it cannot be displayed in the ps listing, no matter what options do you use. In such a case, the free "lsof" utility is useful: just use "lsof -p " and check the rows with "txt" in the FD column. Often there is only one such line, and that line describes the full path of the command binary.

(Although lsof is not a standard HP-UX command, it is a great tool for sysadmins. It is available in the free Internet Express package from software.hp.com, and in the Porting Archive. It is also compilable using the bundled cc compiler, if you need lsof for some old 10.20 or 11.00. Never leave /home without it! :-)

MK
MK
Dennis Handly
Acclaimed Contributor

Re: ps

I forgot that pstack(1) on 11.31 Integrity should give it.
http://docs.hp.com/en/B2355-60130/pstack.1.html
Johnson Punniyalingam
Honored Contributor

Re: ps

Hi Navin,

man ps "will provide you all information" or options,

Normal "ps" command to show option would be (ef) & grep specfic "process" or file

Example:-

ps -ef |grep smb


Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Dennis Handly
Acclaimed Contributor

Re: ps

>Johnson: Normal "ps" command to show option would be (-ef) & grep specfic "process" or file

It is dangerous to use grep. Instead use:
UNIX95=EXTENDED_PS ps -Hf -C process-name