LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Finding the first pid (https://www.linuxquestions.org/questions/linux-general-1/finding-the-first-pid-48416/)

corrierich 03-05-2003 10:45 AM

Finding the first pid
 
Hi,

I want to find the first pid of a process, if I type...

pidof strs

i get

2606 2607 2608 2609 ...

Anyone know how can I just return 2606?

Thanks

m0rl0ck 03-05-2003 10:51 AM

How about:

pidof strs|cut -d " " -f 1


EDIT:
Hey I read the man page of pidof and it actually has a flag that does this:
-s Single shot - this instructs the program to only return one pid.

man pidof :)

corrierich 03-06-2003 02:43 AM

Sorry m0rl0ck should have read the man page thoughly first. But using cut in this way is will be very useful for me for other things as well

Thanks


All times are GMT -5. The time now is 11:17 PM.