LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-05-2003, 11:45 AM   #1
corrierich
LQ Newbie
 
Registered: Oct 2002
Distribution: Red Hat 7.3
Posts: 10

Rep: Reputation: 0
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
 
Old 03-05-2003, 11:51 AM   #2
m0rl0ck
Member
 
Registered: Nov 2002
Distribution: A totally 133t distro :)
Posts: 358

Rep: Reputation: 31
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

Last edited by m0rl0ck; 03-05-2003 at 12:06 PM.
 
Old 03-06-2003, 03:43 AM   #3
corrierich
LQ Newbie
 
Registered: Oct 2002
Distribution: Red Hat 7.3
Posts: 10

Original Poster
Rep: Reputation: 0
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
logging off by script or finding PID of session bob_man_uk Red Hat 6 10-27-2005 04:37 AM
Advanced question: finding pid of an x window PFudd Linux - Software 3 05-31-2005 06:36 PM
/var/run/[XXX].pid - Tcl pid code liguorir Linux - Software 1 05-20-2004 11:32 PM
finding pid with program name durden2.0 Linux - Newbie 1 08-04-2003 09:38 PM
finding a PID and killing it tangle Linux - General 3 01-25-2003 11:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration