Thread: have to program to get process ID?

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    have to program to get process ID?

    Hello everyone,


    On Linux platform, if I want to get current process (for example, a shell script), are there any ways (for example, a command) to get the process ID without programming.


    regards,
    George

  2. #2
    Registered User
    Join Date
    Dec 2005
    Posts
    136

    Thumbs up

    Yes.
    Command is
    "ps -ef"

    You can get help on ps(process status) command thru manual page of "ps"
    by "man ps".
    S_ccess is waiting for u. Go Ahead, put u there.

  3. #3
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    get the process ID without programming.
    Why did you post this in the C Programming forum then?
    If you understand what you're doing, you're not learning anything.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Too stupid, couldn't find the linux forum, or a search engine. Must be an Ubuntu user.


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Hi quzah,


    Quote Originally Posted by quzah
    Too stupid, couldn't find the linux forum, or a search engine. Must be an Ubuntu user.


    Quzah.
    What means "Ubuntu"?


    regards,
    George

  6. #6
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Quote Originally Posted by George2
    What means "Ubuntu"?
    Yeah... he's either an Ubuntu user or a wiseass.
    Sent from my iPadŽ

  7. #7
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Hi itsme86,


    Quote Originally Posted by itsme86
    Why did you post this in the C Programming forum then?
    Because I want to find a non-programming way, I think programming forum guys should know non-programming way to do the same thing. :-)


    regards,
    George

  8. #8
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Hi SlyMaelstrom,


    Quote Originally Posted by SlyMaelstrom
    Yeah... he's either an Ubuntu user or a wiseass.
    What means a wiseass?


    regards,
    George

  9. #9
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thank you Ken,


    Quote Originally Posted by Ken Fitlike
    Since this seems to be a non-programming question, moved to Tech.

    regards,
    George

  10. #10
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Hi maven,


    Quote Originally Posted by maven
    Yes.
    Command is
    "ps -ef"

    You can get help on ps(process status) command thru manual page of "ps"
    by "man ps".
    I have tried that "ps -ef" will list all the process, but I only want to get the current process ID of a shell script.


    regards,
    George

  11. #11
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    Because I want to find a non-programming way, I think programming forum guys should know non-programming way to do the same thing.
    That is the most warped logic I've heard in awhile.
    If you understand what you're doing, you're not learning anything.

  12. #12
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by George2
    I have tried that "ps -ef" will list all the process, but I only want to get the current process ID of a shell script.
    This is ridiculous.

    Did you even try google? I know close to nothing about Linux. But just found the answer. I won't share it though. Do yourself (really, yourself) a big favor and try to answer your own question before wasting everybody else's time.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  13. #13
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    The command would be
    ps ax | grep "<script name>" | awk {'print $1'}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Process manipulation questions
    By Sfel in forum Windows Programming
    Replies: 7
    Last Post: 05-17-2008, 12:39 PM
  2. Replies: 2
    Last Post: 04-04-2008, 09:42 AM
  3. Round Robin Scheduling using c.
    By eclipt in forum C Programming
    Replies: 8
    Last Post: 12-28-2005, 04:58 PM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM