Thursday, February 16, 2012

How to Kill/Close The Process in Linux.

pkill vlc

or


killall -9 programName
killall -9 firefox
killall -9 lighttpd
killall -9 php-cgi
 First of all identify the "process id" (pid) of the process to kill.
[root@server ~#]ps -e                (display all the process in the system)
  PID TTY       TIME       CMD
    1   ?        00:00:00 init
    2   ?        00:00:00 kthreadd
    3   ?        00:00:00 migration/0
    4   ?        00:00:00 ksoftirqd/0
    5   ?        00:00:00 watchdog/0
    6   ?        00:00:00 events/0
    7   ?        00:00:00 cpuset
    8   ?        00:00:00 khelper
    9   ?        00:00:00 netns
   10   ?       00:00:00 async/mgr
   11   ?       00:00:00 pm
Note:Here the first column(PID) includes the process ids of all the running process.


How to find pid of a process by name
[root@server ~#]ps -e | grep <process name>
eg:  [root@server ~#]ps -e | grep vsftpd
1719   ?        00:00:00 vsftpd                  (pid of vsftpd is 1719)


And KILL the process
[root@server ~#]skill -p <pid>
eg:  [root@server ~#]skill -p 2152   




kill -9 <pid> worked perfectly.

man kill

No comments:

Post a Comment