Tuesday, November 17, 2015

How to check what command/task/process is running on a linux server

$ ps -ewwo pid,args | grep [s]sh


Source: http://www.cyberciti.biz/faq/unix-linux-determine-whether-process-is-running/
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

No comments:

Post a Comment