linux进程管理命令kill,Linux进程管理命令-kill | IT运维网
格式:kill -l [signal]
-l:顯示當前系統可用信號
-l:顯示當前系統可用信號
[root@localhost ~]# kill -l
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP
6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL10) SIGUSR1
11) SIGSEGV12) SIGUSR213) SIGPIPE14) SIGALRM15) SIGTERM
16) SIGSTKFLT17) SIGCHLD18) SIGCONT19) SIGSTOP20) SIGTSTP
21) SIGTTIN22) SIGTTOU23) SIGURG24) SIGXCPU25) SIGXFSZ
26) SIGVTALRM27) SIGPROF28) SIGWINCH29) SIGIO30) SIGPWR
31) SIGSYS34) SIGRTMIN35) SIGRTMIN+136) SIGRTMIN+237) SIGRTMIN+3
38) SIGRTMIN+439) SIGRTMIN+540) SIGRTMIN+641) SIGRTMIN+742) SIGRTMIN+8
43) SIGRTMIN+944) SIGRTMIN+1045) SIGRTMIN+1146) SIGRTMIN+1247) SIGRTMIN+13
48) SIGRTMIN+1449) SIGRTMIN+1550) SIGRTMAX-1451) SIGRTMAX-1352) SIGRTMAX-12
53) SIGRTMAX-1154) SIGRTMAX-1055) SIGRTMAX-956) SIGRTMAX-857) SIGRTMAX-7
58) SIGRTMAX-659) SIGRTMAX-560) SIGRTMAX-461) SIGRTMAX-362) SIGRTMAX-2
63) SIGRTMAX-164) SIGRTMAX
常用信號:
1) SIGHUP: 無須關閉進程而讓其重讀配置文件;PID不變
2) SIGINT: 中斷正在運行的進程;相當于Ctrl+c;
9) SIGKILL: 殺死正在運行的進程;直接終止進程;謹慎
15) SIGTERM:終止正在運行的進程;進程終止前允許可保存數據;默認缺省信號
指定信號的方法:
(1) 信號的數字標識;1, 2, 9
(2) 信號完整名稱;SIGHUP
(3) 信號的簡寫名稱;HUP
格式:kill [-s signal|-p] [-q sigval] [-a] [–] pid…
編號 PID:指定信號模式編號管理進程;推薦用此模式操作
-signal PID:指定信號模式管理進程;
不指定信號為默認使用15信號
[root@localhost ~]# ps auxf |grep sshd
root 1698 0.0 0.0 112812 4280 ? Ss 00:58 0:00 /usr/sbin/sshd -D
root 1699 0.0 0.0 157208 5884 ? Ss 00:58 0:00 \_ sshd: root@pts/0
root 1876 0.0 0.0 112704 960 pts/0 S+ 01:29 0:00 | \_ grep --color=auto sshd
root 1851 0.0 0.0 157208 5816 ? Ss 01:29 0:00 \_ sshd: yvan [priv]
yvan 1853 0.0 0.0 157208 2300 ? S 01:29 0:00 \_ sshd: yvan@pts/1
[root@localhost ~]# kill 1851
[root@localhost ~]# ps auxf |grep sshd
root 1698 0.0 0.0 112812 4280 ? Ss 00:58 0:00 /usr/sbin/sshd -D
root 1699 0.0 0.0 157208 5884 ? Ss 00:58 0:00 \_ sshd: root@pts/0
root 1882 0.0 0.0 112704 960 pts/0 S+ 01:30 0:00 \_ grep --color=auto sshd
編號 PID:指定信號模式編號管理進程
[root@localhost ~]# ps auxf |grep sshd
root 1698 0.0 0.0 112812 4320 ? Ss 00:58 0:00 /usr/sbin/sshd -D
root 1699 0.0 0.0 157208 5884 ? Ss 00:58 0:00 \_ sshd: root@pts/0
root 1909 0.0 0.0 112704 964 pts/0 S+ 01:31 0:00 | \_ grep --color=auto sshd
root 1884 0.1 0.0 157208 5816 ? Ss 01:31 0:00 \_ sshd: yvan [priv]
yvan 1886 0.0 0.0 157208 2300 ? S 01:31 0:00 \_ sshd: yvan@pts/1
[root@localhost ~]# kill 2 1884
[root@localhost ~]# ps auxf |grep sshd
root 1698 0.0 0.0 112812 4320 ? Ss 00:58 0:00 /usr/sbin/sshd -D
root 1699 0.0 0.0 157208 5884 ? Ss 00:58 0:00 \_ sshd: root@pts/0
root 1913 0.0 0.0 112704 960 pts/0 S+ 01:32 0:00 \_ grep --color=auto sshd
signal PID:指定信號模式管理進程;信號模式可簡寫
[root@localhost ~]# ps auxf |grep sshd
root 1698 0.0 0.0 112812 4320 ? Ss 00:58 0:00 /usr/sbin/sshd -D
root 1699 0.0 0.0 157208 5884 ? Ss 00:58 0:00 \_ sshd: root@pts/0
root 2156 0.0 0.0 112704 960 pts/0 S+ 01:47 0:00 | \_ grep --color=auto sshd
root 2131 0.2 0.0 157208 5816 ? Ss 01:46 0:00 \_ sshd: yvan [priv]
yvan 2133 0.0 0.0 157208 2304 ? S 01:46 0:00 \_ sshd: yvan@pts/1
[root@localhost ~]# kill -sigkill 2133
[root@localhost ~]# ps auxf |grep sshd
root 1698 0.0 0.0 112812 4320 ? Ss 00:58 0:00 /usr/sbin/sshd -D
root 1699 0.0 0.0 157208 5884 ? Ss 00:58 0:00 \_ sshd: root@pts/0
root 2160 0.0 0.0 112704 964 pts/0 S+ 01:47 0:00 \_ grep --color=auto sshd
IT運維網 版權所有丨如未注明 , 均為原創丨本網站采用BY-NC-SA協議進行授權 , 轉載請注明Linux進程管理命令-kill!
總結
以上是生活随笔為你收集整理的linux进程管理命令kill,Linux进程管理命令-kill | IT运维网的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: catia怎么将特征参数化_搭建商城网站
- 下一篇: python生成文件夹并向文件夹写文件_