- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- PID to find a process ?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 09:57 AM
07-02-2002 09:57 AM
How would I find a process name if I know the PID ? Also, How can I find if a PID has any children or (if it is a child) if which process is the parent.
Thanks Unix Admins
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 10:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 10:01 AM
07-02-2002 10:01 AM
Re: PID to find a process ?
To find the data you are looking for, do this:
ps -p PID -l.
Man ps for more options and details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 10:02 AM
07-02-2002 10:02 AM
Re: PID to find a process ?
then do ps -fu
Sandip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 10:10 AM
07-02-2002 10:10 AM
Re: PID to find a process ?
# ps -ef|awk '$2==X||$3==X {print $0}' X=
...will give you process name of the
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2002 06:35 PM
07-02-2002 06:35 PM
Re: PID to find a process ?
ps -ef | grep something
but there are BIG problems with this. Suppose you want to find a process with a PID=123 and you use:
ps -ef | grep 123
and you'll get the process, plus any child processes where 123 is the parent, and also PID numbers like: 1234 11234 and you'll also get processes that happen to have 123 in their command line line (like grep 123)
So avoid like the plague the temptation to use grep. Instead, ask ps to get you the exact process name given a PID:
ps -fp PID
Never fails (unless the process is gone).
You need to search by process name? How about finding all sh processes? grep will fail misearably:
ps -ef | grep sh
Let's ask ps to search for exact process name matches:
UNIX95= ps -f -C sh
Notice: no ksh or csh or any other strings.
Bill Hassell, sysadmin