LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to know if a particular process is running (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-know-if-a-particular-process-is-running-615522/)

htamayo 01-22-2008 11:41 AM

how to know if a particular process is running
 
Hi, I need to know if mysql and apache -for example- are running, if I do ps -all it will list me all the process that are running, but is there a way to know if mysql, apache or other process is running?

An example:
some_monitor_command mysql
some_monitor_command apache


Second question:
Sometimes I use more than one session at the same time, for example graphical mode, tty2 (using Alt+F2), tty3 (Alt+F3), so, I do everything I need in tty3 for example, my question is:

Once I finished to use tty3 is there a way to kill tty3? if I go to tty2 and I do a ps -all I can see the process in tty3, so I want to kill all the tt3, can you help me?

Poetics 01-22-2008 11:44 AM

You can grep the results if you wish, such as "ps auxww | grep apache" and the like. This will return only the lines with 'apache' in them, and will scan all currently running processes.

custangro 01-22-2008 11:46 AM

Try using grep to find out what is running...for example:

Code:

ps aux | grep httpd
ps aux | grep mysql

Also if you don't know what you're looking for is called you can use different switches with grep (like grep -i) man grep for more details...

-C

bobmac010 01-22-2008 11:53 AM

Or -

ps -ef | grep httpd
ps -ef | grep mysql


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