LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to get the PID for COMMAND (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-get-the-pid-for-command-710162/)

haseit 03-09-2009 12:38 AM

How to get the PID for COMMAND
 
Hello All,

I 've question on How to get the PID if the CMD is give using "ps" and additional commands.

Eg:

UID PID PPID C STIME TTY TIME CMD
root 3724 1 0 10:06 ? 00:00:00 konqueror -mimetype inode/directory system:/
root 3847 3111 0 10:14 ? 00:00:00 eclipse
root 3848 3847 2 10:14 ? 00:01:17 /usr/bin/java -Xms40m -Xmx256m -Dosgi.sharedConfiguration.area=/usr/lib/eclipse/configuration -jar /usr/shar
root 3973 3111 0 10:25 ? 00:00:01 konsole
root 3974 3973 0 10:25 pts/3 00:00:00 /bin/bash


if i need to get the PID of eclipse in the given CMD colum, How do i get it using the "ps" command.

as in the above eg i only need to get the pid 3847 using the CMD colum
---

Please help me on this

Thank you in advance,
Hasantha

kirukan 03-09-2009 12:45 AM

manpage will help you to find more options
ps ax | grep eclipse
or
pgrep eclipse

haseit 03-09-2009 01:35 AM

Hello kirukan,

Thank you for the support. it worked and i really appriciate for the post.

Regards,

Hasantha

sureshsujatha 03-09-2009 01:54 PM

@kirukan,
I found your inputs very useful for a particular test case scenario I encountered at work. Thanks for sharing your knowledge!
:)


All times are GMT -5. The time now is 09:16 PM.