LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   have to program to get process ID? (https://www.linuxquestions.org/questions/programming-9/have-to-program-to-get-process-id-476480/)

George2 08-23-2006 03:01 AM

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

BiThian 08-23-2006 03:20 AM

"man ps" or (h)top
Try this: ps -e | grep name_process

George2 08-23-2006 08:04 AM

Thank you BiThian,


Quote:

Originally Posted by BiThian
"man ps" or (h)top
Try this: ps -e | grep name_process


regards,
George

pwc101 08-23-2006 08:08 AM

pgrep and pkill are also worth looking into. From the manpage:
Quote:

NAME
pgrep, pkill - look up or signal processes based on name and other
attributes

xhi 08-23-2006 08:11 AM

i usually do a

`ps aux`

chrism01 08-24-2006 02:05 AM

pid=$$
and some more text to avoid 10 char min limit in post; sigh ....

kshkid 08-24-2006 03:07 AM

Quote:

Originally Posted by chrism01
pid=$$
and some more text to avoid 10 char min limit in post; sigh ....


and that $$ - is valid only for the current working shell


All times are GMT -5. The time now is 02:20 AM.