1847000 Members
4024 Online
110257 Solutions
New Discussion

Process ID

 
Tirtha
Occasional Advisor

Process ID

Hi frnds
Which one is PID?

# ps -ef|grep sam
root 24702 24222 0 21:19:59 pts/tb 0:00 grep sam

Please give me the full description of this line.
5 REPLIES 5
johnsonpk
Honored Contributor

Re: Process ID

Hello

root >> The login name of the real process owner.

24702 >>The process ID number of the process.

24222 >>The process ID number of the parent process.

21:19:59>>Starting time of the process. If the elapsed time
is greater than 24 hours, the starting date is
displayed instead.

pts/tb>>The controlling terminal for the process

0:00 >>The cumulative execution time for the process

grep sam >> process


Rgds
Johnson
James R. Ferguson
Acclaimed Contributor

Re: Process ID

Hi:

> Please give me the full description of this line.

And why not ask the manpages? You will learn a great deal from them.

That said, rather than fuzzily matching the basename of a process with 'grep', use the UNIX95 extensions of 'ps':

# UNIX95= ps -f -C cron

Note that the UNIX95 (otherwise known as XPG4) behavior is confined to the command line only by writing 'UNIX95= ps' without any semicolon after the "=" and before the command. Do not set UNIX95 in your profile nor export it to your environment. It affects different commands in different ways and you need to know when and how.

By the way, in your posted command, no process named 'sam' was found. Rather a process named 'grep' with an argument named "sam" was returned!

Regards!

...JRF...

Dennis Handly
Acclaimed Contributor

Re: Process ID

>Please give me the full description of this line.

If you pipe the output to head(1) or more(1) you'll get the titles for each column, that you can match up to the man page.
Basheer_2
Trusted Contributor

Re: Process ID

you can use the head for this

ps -ef |head -1
UID PID PPID C STIME TTY TIME COMMAND

now for your case
root 24702 24222 0 21:19:59 pts/tb 0:00 grep sam

so the first one PID is the process ID

Steven Schweda
Honored Contributor

Re: Process ID

Did you notice that you're looking at the
process for your "grep" command, not for a
"sam" process, which is what you seem to be
looking for.