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
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop














{ 2 comments… read them below or add one }
U can also do that without using user defined format….
ps -eaf |grep [s]sh
easy to remember than that…
if you want to see whether a process is running on your environment or not just go to your terminal and type a command on CLI
(root@local-host)# ps -ef | grep process_name
Here ps -ef used for displaying of all running process
grep is used for searching purpose here grep process_name search the process
ps -ef will be input to grep process_name by using pipesymbol