To kill processes by name use the killall command. The syntax is as follows:
killall -SIGNAME process-nameThe default signal for kill is TERM (terminate process). To list available signals, enter:
$ kill -l
The following are useful signals and used frequently by sys admins and Ubuntu users:
- SIGHUP (1) - Hangup detected on controlling terminal or death of controlling process.
- SIGINT (2) - Interrupt from keyboard.
- SIGKILL (9) - Kill signal i.e. kill running process.
- SIGSTOP (19) - Stop process.
- SIGCONT (18) - Continue process if stopped.
Examples - Ubuntu Linux: Killing Process
To kill all apache2 process, enter:$ sudo killall -9 apache2
To kill all firefox process, enter:
$ sudo killall -9 firefox-bin
You can also use the pkill command as follows to kill all php-cgi process, enter:
$ pkill -KILL php-cgi
The -u option will kill only processes whose effective user ID is set to vivek:
$ sudo pkill -KILL -u vivek php-cgi
No comments:
Post a Comment