网站首页网站地图google地图百度地图学习库RSS在线PSPS联盟素材下载  PS视频教程专题 PS爱好者教程网www.psahz.com PS教程自学网QQ群

linux kill命令使用教程,kill函数命令学习心得。(2)

时间:2016-07-31 16:52 来源:linux kill命令 作者:kill 阅读:

实例2:得到指定信号的数值

命令:

输出:

[root@localhost test6]# kill -l KILL

9[root@localhost test6]# kill -l SIGKILL

9[root@localhost test6]# kill -l TERM

15[root@localhost test6]# kill -l SIGTERM

15[root@localhost test6]#

 

说明:

 

实例3:先用ps查找进程,然后用kill杀掉

命令:

kill 3268

输出:

[root@localhost test6]# ps -ef|grep vim 

root      3268  2884  0 16:21 pts/1    00:00:00 vim install.log

root      3370  2822  0 16:21 pts/0    00:00:00 grep vim

[root@localhost test6]# kill 3268 

[root@localhost test6]# kill 3268 

-bash: kill: (3268) - 没有那个进程

[root@localhost test6]#

说明:

 

实例4:彻底杀死进程

命令:

kill –9 3268 

输出:

[root@localhost test6]# ps -ef|grep vim 

root      3268  2884  0 16:21 pts/1    00:00:00 vim install.log

root      3370  2822  0 16:21 pts/0    00:00:00 grep vim

[root@localhost test6]# kill –9 3268 

[root@localhost test6]# kill 3268 

-bash: kill: (3268) - 没有那个进程

[root@localhost test6]#

 

说明:

 

实例5:杀死指定用户所有进程

命令:

kill -9 $(ps -ef | grep peidalinux)

kill -u peidalinux

输出:

[root@localhost ~]# kill -9 $(ps -ef | grep peidalinux) 

[root@localhost ~]# kill -u peidalinux

说明:

方法一,过滤出hnlinux用户进程并杀死

 

实例6:init进程是不可杀的

命令:

kill -9 1

输出:

[root@localhost ~]# ps -ef|grep init

root         1     0  0 Nov02 ?        00:00:00 init [3]                  

root     17563 17534  0 17:37 pts/1    00:00:00 grep init

[root@localhost ~]# kill -9 1

[root@localhost ~]# kill -HUP 1

[root@localhost ~]# ps -ef|grep init

root         1     0  0 Nov02 ?        00:00:00 init [3]                  

root     17565 17534  0 17:38 pts/1    00:00:00 grep init

[root@localhost ~]# kill -KILL 1

[root@localhost ~]# ps -ef|grep init

root         1     0  0 Nov02 ?        00:00:00 init [3]                  

root     17567 17534  0 17:38 pts/1    00:00:00 grep init

[root@localhost ~]#

 

说明:

init是Linux系统操作中不可缺少的程序之一。所谓的init进程,它是一个由内核启动的用户级进程。内核自行启动(已经被载入内存,开始运行,并已初始化所有的设备驱动程序和数据结构等)之后,就通过启动一个用户级程序init的方式,完成引导进程。所以,init始终是第一个进程(其进程编号始终为1)。 其它所有进程都是init进程的子孙。init进程是不可杀的!

PS笔刷下载 PS滤镜下载 PS形状下载 PS样式下载 PS动作下载 PS图案下载