Wednesday, July 9, 2008

Linux Getting info of a process like pid(process id)

there are a collection of command to find the process information. which are:

1) Simply use ps command as follows:

ps aux | grep {process-name}
For example find out if mysqld process (mysqld pid) is running or not:
$ ps aux | grep mysqld
Output:

mysql    28290  1.1  2.7 340496 56812 ?        Sl   Jul31 348:27 /usr/libexec/mysqld


2)Find the process ID of a running program using pidof
pidof command finds the process id’s (pids) of the named programs. It prints those id’s on screen.

# pidof httpd
1874 1873 1872 1863 1862 1861 1860 1859 1829

3)PG grep is also used to know the PID

u can use pgrep like this
pgrep process name
pgrep httpd
pgrep named
pgrep firefox


1 comment:

Shaun Reich (sreich) said...

Thanks, after googling, this certainly helped.

 
Custom Search