kill

通过指定进程的PID,通过信号或强制终止来终止进程。

语法

  kill [-s sigspec] [-n signum] [-sigspec] jobspec or pid
  kill -l [exit_status]
  kill -l [sigspec]

选项

-l   列出信号名称
-s   发送特定信号
-n   发送特定信号数

将sigspec或signum指定的信号发送 到作业jobspec或进程ID pid指定的进程

sigspec是一个不区分大小写的信号名称,例如SIGINT(带或不带SIG前缀)或信号编号; signum是一个信号编号

如果不存在sigspec,SIGTERM则使用(终止)

常见的kill信号

信号名称 信号值 影响
SIGHUP 1 挂断
SIGINT 2 键盘中断
SIGQUIT 3 放弃
SIGABRT 6 退出
SIGKILL 9 杀死信号
SIGTERM 15 终止信号 - 允许有序关机
SIGSTOP 17,19,23 停止这个进程

实例
列出正在运行的进程

$ ps
PID TTY TIME CMD
1293 pts/5 00:00:00 MyProgram

干掉1293进程

 $ kill 1293

5秒后干掉1293进程:

$ my_command & sleep 5 
$ kill -0 $! && kill $!

kill是一个内置命令的bash: $ help kill

kill 命令实例:

linux命令:killall firefox firefox killall killall firefoxrootopen.com
linux命令:killall firefox firefox killall killall firefoxrootopen.com
2018-09-11 09:55:30

linux命令:kill -HUP ` ps -aef | grep -i firefox | sort -k 2 -r | sed 1d | awk ' { print $2 } ' ` ` ' } $2 print { ' awk | 1d sed | -r 2 -k sort | firefox -i grep | -aef ps ` -HUP kill kill -HUP ` ps -aef | grep -i firefox | sort -k 2 -r | sed 1d | awk ' { print $2 } ' `rootopen.com
linux命令:kill -HUP ` ps -aef | grep -i firefox | sort -k 2 -r | sed 1d | awk ' { print $2 } ' ` ` ' } $2 print { ' awk | 1d sed | -r 2 -k sort | firefox -i grep | -aef ps ` -HUP kill kill -HUP ` ps -aef | grep -i firefox | sort -k 2 -r | sed 1d | awk ' { print $2 } ' `rootopen.com
2018-02-02 04:04:48

linux命令:kill -HUP `ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}'` $2}'` '{print awk | '^[Zz]' -e grep | -ostat,ppid,pid,cmd -A `ps -HUP kill kill -HUP `ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}'`rootopen.com
linux命令:kill -HUP `ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}'` $2}'` '{print awk | '^[Zz]' -e grep | -ostat,ppid,pid,cmd -A `ps -HUP kill kill -HUP `ps -A -ostat,ppid,pid,cmd | grep -e '^[Zz]' | awk '{print $2}'`rootopen.com
2018-02-26 02:28:48

linux命令:kill -9 $(pidof *program*) *program*) $(pidof -9 kill kill -9 $(pidof *program*)rootopen.com
linux命令:kill -9 $(pidof *program*) *program*) $(pidof -9 kill kill -9 $(pidof *program*)rootopen.com
2018-03-09 23:09:48

linux命令:killall nautilus nautilus killall killall nautilusrootopen.com
linux命令:killall nautilus nautilus killall killall nautilusrootopen.com
2018-03-08 02:04:48

linux命令:kill -9 $$ $$ -9 kill kill -9 $$rootopen.com
linux命令:kill -9 $$ $$ -9 kill kill -9 $$rootopen.com
2018-02-28 21:24:48

linux命令:killall -9 wineserver wineserver -9 killall killall -9 wineserverrootopen.com
linux命令:killall -9 wineserver wineserver -9 killall killall -9 wineserverrootopen.com
2018-04-11 02:15:48

linux命令:killall -USR1 dd dd -USR1 killall killall -USR1 ddrootopen.com
linux命令:killall -USR1 dd dd -USR1 killall killall -USR1 ddrootopen.com
2018-04-02 01:25:48

linux命令:kill -9 $(pidof process) process) $(pidof -9 kill kill -9 $(pidof process)rootopen.com
linux命令:kill -9 $(pidof process) process) $(pidof -9 kill kill -9 $(pidof process)rootopen.com
2018-03-15 23:48:48

linux命令:kill -9 `ps -u <username> -o "pid="` "pid="` -o <username> -u `ps -9 kill kill -9 `ps -u <username> -o "pid="`rootopen.com
linux命令:kill -9 `ps -u <username> -o "pid="` "pid="` -o <username> -u `ps -9 kill kill -9 `ps -u <username> -o "pid="`rootopen.com
2018-05-16 17:31:48

linux命令:kill -9 $$ $$ -9 kill kill -9 $$rootopen.com
linux命令:kill -9 $$ $$ -9 kill kill -9 $$rootopen.com
2018-02-08 15:25:48

linux命令:kill %1 %1 kill kill %1rootopen.com
linux命令:kill %1 %1 kill kill %1rootopen.com
2018-01-24 05:14:48

linux命令:killall -STOP -m firefox firefox -m -STOP killall killall -STOP -m firefoxrootopen.com
linux命令:killall -STOP -m firefox firefox -m -STOP killall killall -STOP -m firefoxrootopen.com
2018-03-24 08:43:48

linux命令:kill -0 [pid] [pid] -0 kill kill -0 [pid]rootopen.com
linux命令:kill -0 [pid] [pid] -0 kill kill -0 [pid]rootopen.com
2018-01-08 13:52:48

linux命令:killall -s 9 krunner_lock krunner_lock 9 -s killall killall -s 9 krunner_lockrootopen.com
linux命令:killall -s 9 krunner_lock krunner_lock 9 -s killall killall -s 9 krunner_lockrootopen.com
2018-04-25 15:32:48

linux命令:kill_daemon() { echo "Daemon?"; read dm; kill -15 $(netstat -atulpe | grep $dm | cut -d '/' -f1 | awk '{print $9}') }; alias kd='kill_daemon kd='kill_daemon alias }; $9}') '{print awk | -f1 '/' -d cut | $dm grep | -atulpe $(netstat -15 kill dm; read "Daemon?"; echo { kill_daemon() kill_daemon() { echo "Daemon?"; read dm; kill -15 $(netstat -atulpe | grep $dm | cut -d '/' -f1 | awk '{print $9}') }; alias kd='kill_daemonrootopen.com
linux命令:kill_daemon() { echo "Daemon?"; read dm; kill -15 $(netstat -atulpe | grep $dm | cut -d '/' -f1 | awk '{print $9}') }; alias kd='kill_daemon kd='kill_daemon alias }; $9}') '{print awk | -f1 '/' -d cut | $dm grep | -atulpe $(netstat -15 kill dm; read "Daemon?"; echo { kill_daemon() kill_daemon() { echo "Daemon?"; read dm; kill -15 $(netstat -atulpe | grep $dm | cut -d '/' -f1 | awk '{print $9}') }; alias kd='kill_daemonrootopen.com
2018-01-15 17:07:48

linux命令:killall -2 mpg321 mpg321 -2 killall killall -2 mpg321rootopen.com
linux命令:killall -2 mpg321 mpg321 -2 killall killall -2 mpg321rootopen.com
2018-02-05 20:44:48

linux命令:kill -9 <replace this with pid you want to kill> kill> to want you pid with this <replace -9 kill kill -9 <replace this with pid you want to kill>rootopen.com
linux命令:kill -9 <replace this with pid you want to kill> kill> to want you pid with this <replace -9 kill kill -9 <replace this with pid you want to kill>rootopen.com
2018-01-16 01:57:48

linux命令:killall -INFO dd dd -INFO killall killall -INFO ddrootopen.com
linux命令:killall -INFO dd dd -INFO killall killall -INFO ddrootopen.com
2018-01-01 10:15:48

linux命令:kill -3 PID PID -3 kill kill -3 PIDrootopen.com
linux命令:kill -3 PID PID -3 kill kill -3 PIDrootopen.com
2018-01-25 05:53:48

linux命令:kill -9 `pgrep firefox` firefox` `pgrep -9 kill kill -9 `pgrep firefox`rootopen.com
linux命令:kill -9 `pgrep firefox` firefox` `pgrep -9 kill kill -9 `pgrep firefox`rootopen.com
2018-05-12 01:23:48

linux命令:killall -9 rouge-process rouge-process -9 killall killall -9 rouge-processrootopen.com
linux命令:killall -9 rouge-process rouge-process -9 killall killall -9 rouge-processrootopen.com
2018-01-22 00:08:48

linux命令:killall rapidly_spawning_process ; killall rapidly_spawning_process ; killall rapidly_spawning_process rapidly_spawning_process killall ; rapidly_spawning_process killall ; rapidly_spawning_process killall killall rapidly_spawning_process ; killall rapidly_spawning_process ; killall rapidly_spawning_processrootopen.com
linux命令:killall rapidly_spawning_process ; killall rapidly_spawning_process ; killall rapidly_spawning_process rapidly_spawning_process killall ; rapidly_spawning_process killall ; rapidly_spawning_process killall killall rapidly_spawning_process ; killall rapidly_spawning_process ; killall rapidly_spawning_processrootopen.com
2018-01-26 20:39:48

linux命令:kill -9 `pgrep $PROCESS_NAME` $PROCESS_NAME` `pgrep -9 kill kill -9 `pgrep $PROCESS_NAME`rootopen.com
linux命令:kill -9 `pgrep $PROCESS_NAME` $PROCESS_NAME` `pgrep -9 kill kill -9 `pgrep $PROCESS_NAME`rootopen.com
2018-03-22 15:10:48

linux命令:kill HUP `pidof '/usr/bin/X'` '/usr/bin/X'` `pidof HUP kill kill HUP `pidof '/usr/bin/X'`rootopen.com
linux命令:kill HUP `pidof '/usr/bin/X'` '/usr/bin/X'` `pidof HUP kill kill HUP `pidof '/usr/bin/X'`rootopen.com
2018-03-30 08:48:48

linux命令:kill -9 `ps aux | grep "search_criteria" | awk '{if ($2 != pid) print $2}'` $2}'` print pid) != ($2 '{if awk | "search_criteria" grep | aux `ps -9 kill kill -9 `ps aux | grep "search_criteria" | awk '{if ($2 != pid) print $2}'`rootopen.com
linux命令:kill -9 `ps aux | grep "search_criteria" | awk '{if ($2 != pid) print $2}'` $2}'` print pid) != ($2 '{if awk | "search_criteria" grep | aux `ps -9 kill kill -9 `ps aux | grep "search_criteria" | awk '{if ($2 != pid) print $2}'`rootopen.com
2018-03-09 01:04:48

linux命令:killall <name> <name> killall killall <name>rootopen.com
linux命令:killall <name> <name> killall killall <name>rootopen.com
2018-05-24 17:13:48

linux命令:kill -9 `ps ax | egrep [f]elix.jar | egrep -o -e '^ *[0-9]+'` *[0-9]+'` '^ -e -o egrep | [f]elix.jar egrep | ax `ps -9 kill kill -9 `ps ax | egrep [f]elix.jar | egrep -o -e '^ *[0-9]+'`rootopen.com
linux命令:kill -9 `ps ax | egrep [f]elix.jar | egrep -o -e '^ *[0-9]+'` *[0-9]+'` '^ -e -o egrep | [f]elix.jar egrep | ax `ps -9 kill kill -9 `ps ax | egrep [f]elix.jar | egrep -o -e '^ *[0-9]+'`rootopen.com
2018-06-09 22:14:48

linux命令:kill -9 `ps -xaw -o state -o pid | grep Z | grep -v PID | awk '{print $2}'` $2}'` '{print awk | PID -v grep | Z grep | pid -o state -o -xaw `ps -9 kill kill -9 `ps -xaw -o state -o pid | grep Z | grep -v PID | awk '{print $2}'`rootopen.com
linux命令:kill -9 `ps -xaw -o state -o pid | grep Z | grep -v PID | awk '{print $2}'` $2}'` '{print awk | PID -v grep | Z grep | pid -o state -o -xaw `ps -9 kill kill -9 `ps -xaw -o state -o pid | grep Z | grep -v PID | awk '{print $2}'`rootopen.com
2018-02-07 20:07:48

linux命令:kill -9 `ps -xaw -o state -o ppid | grep Z | grep -v PID | awk '{print $2}'` $2}'` '{print awk | PID -v grep | Z grep | ppid -o state -o -xaw `ps -9 kill kill -9 `ps -xaw -o state -o ppid | grep Z | grep -v PID | awk '{print $2}'`rootopen.com
linux命令:kill -9 `ps -xaw -o state -o ppid | grep Z | grep -v PID | awk '{print $2}'` $2}'` '{print awk | PID -v grep | Z grep | ppid -o state -o -xaw `ps -9 kill kill -9 `ps -xaw -o state -o ppid | grep Z | grep -v PID | awk '{print $2}'`rootopen.com
2018-03-31 01:41:48

linux命令:kill -9 `ps xawo state=,pid=|sed -n 's/Z //p'` //p'` 's/Z -n state=,pid=|sed xawo `ps -9 kill kill -9 `ps xawo state=,pid=|sed -n 's/Z //p'`rootopen.com
linux命令:kill -9 `ps xawo state=,pid=|sed -n 's/Z //p'` //p'` 's/Z -n state=,pid=|sed xawo `ps -9 kill kill -9 `ps xawo state=,pid=|sed -n 's/Z //p'`rootopen.com
2018-06-06 09:55:48

linux命令:killall xmms xmms killall killall xmmsrootopen.com
linux命令:killall xmms xmms killall killall xmmsrootopen.com
2018-02-02 01:56:48

linux命令:kill -9 -1 -1 -9 kill kill -9 -1rootopen.com
linux命令:kill -9 -1 -1 -9 kill kill -9 -1rootopen.com
2018-01-08 11:07:48

linux命令:kill `ps aux | grep xmms | grep -v grep | awk '{ print $2 }'` }'` $2 print '{ awk | grep -v grep | xmms grep | aux `ps kill kill `ps aux | grep xmms | grep -v grep | awk '{ print $2 }'`rootopen.com
linux命令:kill `ps aux | grep xmms | grep -v grep | awk '{ print $2 }'` }'` $2 print '{ awk | grep -v grep | xmms grep | aux `ps kill kill `ps aux | grep xmms | grep -v grep | awk '{ print $2 }'`rootopen.com
2018-03-18 13:11:48

linux命令:kill -l -l kill kill -lrootopen.com
linux命令:kill -l -l kill kill -lrootopen.com
2018-01-12 14:18:48

linux命令:kill -9 `lsof -t -i :port_number` :port_number` -i -t `lsof -9 kill kill -9 `lsof -t -i :port_number`rootopen.com
linux命令:kill -9 `lsof -t -i :port_number` :port_number` -i -t `lsof -9 kill kill -9 `lsof -t -i :port_number`rootopen.com
2018-01-24 00:16:48

linux命令:killall -r 'a regular expression' expression' regular 'a -r killall killall -r 'a regular expression'rootopen.com
linux命令:killall -r 'a regular expression' expression' regular 'a -r killall killall -r 'a regular expression'rootopen.com
2018-06-04 06:47:48

linux命令:kill -9 `ps -u user -o "pid="` "pid="` -o user -u `ps -9 kill kill -9 `ps -u user -o "pid="`rootopen.com
linux命令:kill -9 `ps -u user -o "pid="` "pid="` -o user -u `ps -9 kill kill -9 `ps -u user -o "pid="`rootopen.com
2018-01-19 16:08:48

linux命令:kill -SIGHUP `cat /var/run/mydns.pid` /var/run/mydns.pid` `cat -SIGHUP kill kill -SIGHUP `cat /var/run/mydns.pid`rootopen.com
linux命令:kill -SIGHUP `cat /var/run/mydns.pid` /var/run/mydns.pid` `cat -SIGHUP kill kill -SIGHUP `cat /var/run/mydns.pid`rootopen.com
2018-05-30 12:52:48

linux命令:killall -r 'Activ' 'Activ' -r killall killall -r 'Activ'rootopen.com
linux命令:killall -r 'Activ' 'Activ' -r killall killall -r 'Activ'rootopen.com
2018-01-27 13:17:48

linux命令:killall -u username username -u killall killall -u usernamerootopen.com
linux命令:killall -u username username -u killall killall -u usernamerootopen.com
2018-03-12 07:26:48

linux命令:killall -9 <processname> <processname> -9 killall killall -9 <processname>rootopen.com
linux命令:killall -9 <processname> <processname> -9 killall killall -9 <processname>rootopen.com
2018-02-07 19:46:48

linux命令:kill -9 $(ps -ef | grep [h]ttpd | awk '{print $2}') $2}') '{print awk | [h]ttpd grep | -ef $(ps -9 kill kill -9 $(ps -ef | grep [h]ttpd | awk '{print $2}')rootopen.com
linux命令:kill -9 $(ps -ef | grep [h]ttpd | awk '{print $2}') $2}') '{print awk | [h]ttpd grep | -ef $(ps -9 kill kill -9 $(ps -ef | grep [h]ttpd | awk '{print $2}')rootopen.com
2018-01-07 09:37:48

linux命令:kill $(pidof chrome) chrome) $(pidof kill kill $(pidof chrome)rootopen.com
linux命令:kill $(pidof chrome) chrome) $(pidof kill kill $(pidof chrome)rootopen.com
2017-12-30 05:45:48

linux命令:kill -9 $(pidof chrome) chrome) $(pidof -9 kill kill -9 $(pidof chrome)rootopen.com
linux命令:kill -9 $(pidof chrome) chrome) $(pidof -9 kill kill -9 $(pidof chrome)rootopen.com
2018-02-21 13:50:48

linux命令:killall "Google Chrome" Chrome" "Google killall killall "Google Chrome"rootopen.com
linux命令:killall "Google Chrome" Chrome" "Google killall killall "Google Chrome"rootopen.com
2018-03-30 18:45:48

linux命令:kill -SIGUSR1 xxxx xxxx -SIGUSR1 kill kill -SIGUSR1 xxxxrootopen.com
linux命令:kill -SIGUSR1 xxxx xxxx -SIGUSR1 kill kill -SIGUSR1 xxxxrootopen.com
2018-03-06 19:43:48

linux命令:kill -9 -$(ps x -o "%c %r" | awk '/svscan/{print $2}') $2}') '/svscan/{print awk | %r" "%c -o x -$(ps -9 kill kill -9 -$(ps x -o "%c %r" | awk '/svscan/{print $2}')rootopen.com
linux命令:kill -9 -$(ps x -o "%c %r" | awk '/svscan/{print $2}') $2}') '/svscan/{print awk | %r" "%c -o x -$(ps -9 kill kill -9 -$(ps x -o "%c %r" | awk '/svscan/{print $2}')rootopen.com
2018-01-21 23:35:48

linux命令:killall -HUP argument argument -HUP killall killall -HUP argumentrootopen.com
linux命令:killall -HUP argument argument -HUP killall killall -HUP argumentrootopen.com
2018-05-17 02:57:48

linux命令:kill -9 `ps -u <user> -o "pid="` "pid="` -o <user> -u `ps -9 kill kill -9 `ps -u <user> -o "pid="`rootopen.com
linux命令:kill -9 `ps -u <user> -o "pid="` "pid="` -o <user> -u `ps -9 kill kill -9 `ps -u <user> -o "pid="`rootopen.com
2018-03-10 00:56:48

Linux的Bash命令行(A-Z排序)