Pages

Terminating running process in Linux or Unix system

Running process in Unix or Linux system sometimes are not responding or stop working for long period, to solve the problem the process need to be restarted or terminated, here are some technique to solve the problem.
First.
Open your Unix/Linux shell terminal.
Second.
Find the process id that going to be killed.
use ps or pidof to list the running process id.

ps aux | grep process_name
pidof process_name
example:
ps aux | grep lighttpd
the output from the command above
lighttpd  3486  0.0  0.1   4248  1432 ?        S    Jul31   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd  3492  0.0  0.5  13752  3936 ?        Ss   Jul31   0:00 /usr/bin/php5-cg
or using pidof
example:
pidof lighttpd
the output from the command above
3486
Third.
Use the kill command
kill PID_number
example:
kill 3486
use the -9 command option if you want to terminate instantly the  process from the id which has been defined.
killall command.
Don't use this command in Unix system, it will terminate all running process, use this command only in Linux System.
the syntax
killall -9 process_name
example
killall -9 lighttpd

Source: here

0 comments:

Post a Comment