Quick links: C-Tricks HR Interview Que. Code Snippets C Programs C++ Programs Java Programs PHP Examples

Home » Linux

Linux Terminal Commands - Process management commands (ps,kill)

Working with ps,kill command (Process management commands)




command description
ps This command show all running (working) processes.
                                  
ih@linux:~$ ps

ps   -e This command is used to show all processes with PID, TTY, TIME, CMD.
          
ih@linux:~$ ps -e

ps   -a This command is used to show all processes with PID, TTY, TIME, STAT, CMD.
                                  
ih@linux:~$ ps -A

ps   -A This command is used to show all processes.
                                  
ih@linux:~$  ps -A

ps   -C This command is used to show all processes sorted by command name.
                                  
ih@linux:~$ ps -C

ps   -g This command is used to show all processes by read group ID.
                                  
ih@linux:~$ ps -g

ps   -u This command is used to show all processes by read user ID.
                                  
ih@linux:~$ ps -u

ps   -p This command is used to show all processes by process ID.
                                  
ih@linux:~$ ps -p

ps   -x This command is used to show all processes without controlling ttys.
                                  
ih@linux:~$ ps -x

ps   -ax This command is used to show all processes without controlling ttys.
                                  
ih@linux:~$ ps -ax

top This command is used to display all linux tasks.
                                  
ih@linux:~$ top

kill   PID This command kills the process of given PID.
                                  
ih@linux:~$ kill 123
**** process will be killed of PID 123 ****
killall   proc This command kills all the processes names "proc".
                                  
ih@linux:~$ killall linux
**** process will be killed all processes names "linux" ****
bg This command shows the list of all the background processes.
                                  
ih@linux:~$ bg

fg This command brings the most recent process to foreground.
                                  
ih@linux:~$ fg

fg n This command brings the process n to the foreground.
                                  
ih@linux:~$ fg   -n