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. 自然语言处理(三)——PTB数据的batching方法

    参考书 <TensorFlow:实战Google深度学习框架>(第2版) 从文本文件中读取数据,并按照下面介绍的方案将数据整理成batch. 方法是:先将整个文档切分成若干连续段落,再让b ...

  2. ZooKeeper-3.3.4集群安装配置(转载)

    ZooKeeper是一个分布式开源框架,提供了协调分布式应用的基本服务,它向外部应用暴露一组通用服务——分布式同步(Distributed Synchronization).命名服务(Naming S ...

  3. C - Heavy Transportation

    //改版dijkstra #include <iostream> #include <algorithm> #define Faster ios::sync_with_stdi ...

  4. centos7安装文档

    1.当载入安装镜像时,我们会看到如下图中的画面,我们选择第一项,安装centos7 2.选择英语(个人测试环境可以使用中文安装) 3.选择network&hostname配置网络 4.在配置网 ...

  5. 海康威视采集卡结合opencv使用(两种方法)-转

    (注:第一种方法是我的原创 ^_^. 第二种方法是从网上学习的.) 第一种方法:利用 板卡的API:  GetJpegImage 得到 Jpeg 格式的图像数据,然后用opencv里的一个函数进行解码 ...

  6. uvm_scoreboard——得分

    scoreboard 是验证平台很重要的一部分,因为,验证就是给激励,然后,检查结果.而scoreboard 就是肩负这检查结果的重任.测试用例能不能过,全由scoreboard说了算. A scor ...

  7. Objective-C Runtime Reference

    This document describes the OS X Objective-C 2.0 runtime library support functions and data structur ...

  8. Windows系统下如何优化Android Studio

    Android Studio将是Android开发大势所趋. 安装Android Studio时需注意的细节: · 找到安装目录bin目录下idea.properties 最后一行加入:    dis ...

  9. 求矩阵的n次方 c语言实现

    矩阵的n次方,比较容易理解的想法是递归. 思路是这样的,把n分成两部分,当n是偶数的时候,即为左右两边的乘积,如果n是奇数,即为左右两边的乘积再乘a ) matrixn())^*a else matr ...

  10. SAP C/4HANA到底包含哪些产品?

    2018年6月的SAPPHIRE(蓝宝石大会)上, SAP发布了新的商务软件套件:C/4HANA,意在通过SAP C/4HANA将前台应用和SAP Digital Core(数字化核心)S/4HANA ...