1. Kill Command – Kill the process by specifying its PID

All the below kill conventions will send the TERM signal to the specified process. For the signals, either the signal name or signal number can be used. You need to lookup the pid for the process and give it as an argument to kill.

$ kill -TERM pid

$ kill -SIGTERM pid

$ kill -15 pid

Example: Kill the firefox process.

$ ps -ef | grep firefox
1986 ? Sl 7:22 /usr/lib/firefox-3.5.3/firefox $ kill -9 1986

2. Killall Command – Kill processes by name

Instead of specifying a process by its PID, you can specify the name of the process. If more than one process runs with that name, all of them will be killed.
Example: Kill all the firefox processes

$ killall -9 firefox

3. Pkill Command – Send signal to the process based on its name

You can send signal to any process by specifying the full name or partial name. So there is no need for you to find out the PID of the process to send the signal.

Example: Send SIGTERM to all the process which has sample in its name.

$ pkill sample

Pkill Example:

Before sending signal, you can verify which are all the process is matching the criteria using “pgrep -l”, which displays the process ID and process name of the matching processes.

In this example, all the processes are designed to log the signal to signal-log, along with its PID.

$ pgrep -l sample
12406 sample-server.p
12425 sample-server.p
12430 sample-garbagec $ pkill -USR1 sample $ cat signal-log
Name: ./sample-server.pl Pid: 12406 Signal Received: USR1
Name: ./sample-server.pl Pid: 12425 Signal Received: USR1
Name: ./sample-garbagecollector.pl Pid: 12430 Signal Received: USR1

Note: The part of name which you specify should be in the character within the first 15 character of the process name.

4. Xkill Command – kill a client by X resource

xkill is the simplest way to kill a malfunctioning program. When you want to kill a process, initiate xkill which will offer an cross-hair cursor. Click on the window with left cursor which will kill that process.

$ xkill
Select the window whose client you wish to kill with button 1....
xkill: killing creator of resource 0x1200003

Note: Actually, xkill instructs XServer to terminate the client.

kill, killall, pkill, xkill的更多相关文章

  1. Linux终止进程的工具kill/killall/pkill/xkill/skill用法区别(转)

    一. 终止进程的工具kill .killall.pkill.xkill 终止一个进程或终止一个正在运行的程序,一般是通过kill .killall.pkill.xkill等进行.比如一个程序已经死掉, ...

  2. 9.4-6 kill & killall & pkill

    kill:终止进程 能够终止你希望停止的进程. kill 命令的参数选项及说明 -l    列出全部的信号名称 -p    指定kill命令只打印相关进程的进程号,而不发送任何信号 -s    指定要 ...

  3. Linux命令——killall 、kill 、pkill、xkill

    参考:killall .kill .pkill 命令详解 Using kill, killall, and pkill 4 Ways to Kill a Process – kill, killall ...

  4. Sending Signals to Processes with kill, killall, and pkill

    The Linux kernel allows many signals to be sent to processes. Use man 7 signals for a complete overv ...

  5. Linux之kill,pkill,killall命令

    kill,pkill,killall这些命令都是用来杀死进程的 查找进程的方法: ps -ef|grep pidof 进程名 ps命令 http://www.cnblogs.com/along1226 ...

  6. killall 、kill 、pkill 命令详解

    killall 命令 Linux系统中的killall命令用于杀死指定名字的进程(kill processes by name).我们可以使用kill命令杀死指定进程PID的进程,如果要找到我们需要杀 ...

  7. killall 、kill 、pkill 命令详解 【转】

    之前常用地kill 命令就是 kill -9 XXid;kill -15 XXid;pkill 进程名: 今天发现killall也有适用场景,killall命令对杀死进程组(一个进程中有多线程的情况) ...

  8. killall 、kill 、pkill 命令区别

    转至:https://zhuanlan.zhihu.com/p/87904563 killall 命令 Linux系统中的killall命令用于杀死指定名字的进程(kill processes by ...

  9. Linux中kill,pkill,killall和xkill命令汇总讲解

    终止一个进程或终止一个正在运行的程式,一般是通过 kill .killall.pkill.xkill 等进行.比如一个程式已死掉,但又不能退出,这时就应该考虑应用这些工具. 另 外应用的场合就是在服务 ...

随机推荐

  1. 第一篇 Nosql讲解之Redis,Memchche,MongoDb的区别

    本篇文章主要介绍Nosql的一些东西,以及Nosql中比较火的三个数据库Redis.Memchache.MongoDb和他们之间的区别.以下是本文章的阅读目录 一.Nosql介绍 1.Nosql简介 ...

  2. Android近场通信---NFC基础(四)(转)

    转自http://blog.csdn.net/think_soft/article/details/8184539 从Intent中获取信息 如果因为NFC的Intent而启动一个Activity,那 ...

  3. Java语言和虚拟机规范下载

  4. element-ui + el-dialog + Vue.component 注册的富文本控件 第二次及以后打开dialog出现问题解决方法

    自定控件 添加属性  v-if="dialogVisible" <el-dialog title="" :visible.sync="dialo ...

  5. AFHTTPSessionManager下载文件 及下载中 进度条处理,进度条处理需要特别注意,要加载NSRunLoop 中

    1.下载文件 和进度条处理代码 - (void)timer:(NSTimer *)timer{ // 另一个View中 进度条progress属性赋值 _downloadView.progress = ...

  6. DRF教程6-分页

    rest框架提供自定义分页样式,让你修改再每个页面上显示多少条数据, pagination API 可以: 分页链接作为响应内容的一部分 分页链接包含在响应头里,比如Content-Range or  ...

  7. 使用PHP操作SQL 完成简单的CURD操作

    1.从数据库出发,先建立测试数据,这里使用的MYSQL,通过脚本模式创建测试数据. SET NAMES UTF8; DROP DATABASE IF EXISTS disk; CREATE DATAB ...

  8. css hack 笔记

    body{background-color:#000\9;}/*ie*/ body{background-color:#0f0\9\0;}/*ie9及以上*/ body{background-colo ...

  9. 1047 - Best couple 好题~

    http://www.ifrog.cc/acm/problem/1047 思路很简单,跑一发floyd,然后再用km. 但是问题来了,这个有可能n != m.那怎么办? 其实可以补上一些不存在的点.来 ...

  10. 百度Ueditor多图片上传控件

    发现百度的Ueditor富文本编辑器中的多图片上传控件很不错,于是便想着分享出来使用,费了老劲,少不了无名朋友的帮助,也查了不少资料,终于搞定了 发代码给大家,请大家多多指正 1.首先要在html页面 ...