Linux / UNIX: Find out or determine if process pid is running
Q. How do I find out my process is running? How do I get pid number for particular process?
A. The easiest way to find out is run ps aux command and grep process name. If you got output along with process name/pid, your process is running.
Task: Find out process pid
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 --defaults-file=/etc/my.cnf --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --socket=/var/lib/mysql/mysql.sock
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. This program is on some systems used in run level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should be used instead.
# pidof mysqld
Output:
28290
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Linux find out what process are eating all memory and time allocated to process
- Kill process in Linux or terminate a process in UNIX or Linux systems
- Show all running processes in Linux
- Linux / UNIX: List Open Files for Process
- How to: Find Out Whether a UNIX / Linux Process Is Running or Not
Discussion on This FAQ
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: daemon, find_pids, find_process_pid, grep_command, pidof_command, pids, pid_number, process_id, ps_command, system_v



August 27th, 2007 at 8:14 am
hay man you can use pgrep also know?
why ps -aux | grep process name?
u can use pgrep like this
pgrep process name
pgrep httpd
pgrep named
pgrep firefox
etc
if any special about your command just give me info related to it