How to: Find Out Whether a UNIX / Linux Process Is Running or Not
Q. I'd like to find out if httpd / mysqld or sshd process is running or not under CentOS Linux server. How do I determine whether a process is running or not?
A. You need to use following commands:
[a] ps - It report a snapshot of the current processes
[b] grep - Filter out process names
Find out if sshd is Process is Running or Not
Type the following command at shell prompt:
$ ps -ewwo pid,args | grep [s]sh
Output:
5341 /usr/sbin/sshd 5864 /usr/bin/ssh-agent x-session-manager 6289 ssh oldbox 7126 ssh admin@core.r1.vsnl.router
Where,
- ps : Command name
- -ewwo pid,args : -e option force to select all running processes. -o option is used to specify user-defined format. In our case we are forcing to display only program pid and its arguments. Finally -w option specifies wide output. Use this option twice for unlimited width.
- grep [s]sh : We are just filtering out sshd string
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 / UNIX: Find out or determine if process pid is running
- 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
- renice command: Change the Priority of a Already Running Process
- Show all running processes in Linux
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: centos_linux, grep_command, linux_server, ps_command, running_processes



October 19th, 2007 at 5:51 am
U can also do that without using user defined format….
ps -eaf |grep [s]sh
easy to remember than that…