Intro.

Sometimes, the application we launched from command promp failed to exit. What we require is terminating it without clicking the ‘X’ button in the top of the terminal window. In this case, we prefer the combination of w and pkill, read the flowing for details.


Display termial name

To kill the terminal process, we have to which terminal process we are going to kill! Apparently, w is a simple command that could tell us who is doing what on the current Linux. An example is showing below.

$ w
 14:14:26 up  5:28,  6 users,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
abc      pts/1    172.16.1.137     09:42    3:34m  4:56   4:55  vim a.c
aban     pts/4    192.168.1.7      09:30   16:26   0.18s  0.18s -bash
aban     pts/5    192.168.1.7      09:31    1:47m  4.21s  4.13s nmon
cust     pts/6    172.16.0.133     12:48    1:22m  0.07s  0.07s -bash
aban     pts/9    192.168.1.7      13:59   11:38   0.20s  0.11s vim b.c
aban     pts/10   192.168.1.7      14:02    2.00s  0.05s  0.00s w

In the code above, we could easily find the TTY we intend to kill. For instance, pts/2 is the teriminal we want to kill. What we have to do next is :

pkill -kill -t pts/2

What did just happen after click enter key on our keyboard? Just execute w again, you will not miss the answer!

Have a try and if you have any question, do not hesitate to add post below.

Good luck !

How to kill a particular user terminal on Linux的更多相关文章

  1. Process Kill Technology && Process Protection Against In Linux

    目录 . 引言 . Kill Process By Kill Command && SIGNAL . Kill Process By Resource Limits . Kill Pr ...

  2. Linux进程自保护攻防对抗技术研究(Process Kill Technology && Process Protection Against In Linux)

    0. 引言 0x1: Linux系统攻防思想 在linux下进行"进程kill"和"进程保护"的总体思路有以下几个,我们围绕这几个核心思想展开进行研究 . 直接 ...

  3. mac系统terminal连接linux

    ssh user@hostname user是管理员账号 hostname是服务器ip

  4. 【转载】Linux kill, killall, kill -9

    1) 查看进程的方法:  ps -ef  或者 ps aux root     15087  0.0  0.0      0     0 ?        S    23:31   0:00 [kwo ...

  5. 【Linux常用命令】Linux kill, killall, kill -9,

    参考链接 https://blog.csdn.net/zong596568821xp/article/details/77899454 kill + PID kill -9 + PID  加上-9 是 ...

  6. kill命令

    *杀死进程最安全的方法是单纯使用kill命令,不加修饰符,不带标志.   首先使用ps -ef命令确定要杀死进程的PID,然后输入以下命令:   # kill -pid   注释:标准的kill命令通 ...

  7. CentOS 6.6 中设置Terminal快捷键

    排版比较乱,参见 https://www.zybuluo.com/Jpz/note/144583 CentOS 6.6 中设置Terminal快捷键 Linux开发环境配置 Terminal是Cent ...

  8. 【Kill】两条Linux命令彻底杀死Oracle

    今天编写的两条极具杀伤力的命令,它可以瞬间将Oracle杀死在无形之中.后面我将给出简单注释并展示一下它的威力.$ ps -ef |grep $ORACLE_SID|grep -v grep|awk ...

  9. kill 和killall----杀死进程

    1.根据进程ip查看进程名 Liunx中 通过进程名查找进程PID可以通过 pidof  [进程名] 来查找. 反过来 ,通过PID查找进程名则没有相关命令.但在linux根目录中,有一个/proc的 ...

随机推荐

  1. Drainage Ditches~网络流模板

    Description Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover ...

  2. [LeetCode] Optimal Division 最优分隔

    Given a list of positive integers, the adjacent integers will perform the float division. For exampl ...

  3. MYSQL存储过程中事务和DECLARE EXIT/CONTINUE HANDLER的使用

    -- 1.DECLARE EXIT HANDLER FOR SQLEXCEPTION 语句后面可以跟一个 begin end的复合语句块,也可以直接跟一个简单语句例如 :DECLARE EXIT HA ...

  4. BZOJ4894 天赋

    Description 小明有许多潜在的天赋,他希望学习这些天赋来变得更强.正如许多游戏中一样,小明也有n种潜在的天赋,但有 一些天赋必须是要有前置天赋才能够学习得到的.也就是说,有一些天赋必须是要在 ...

  5. [NOI2011]道路修建

    题目描述 在 W 星球上有 n 个国家.为了各自国家的经济发展,他们决定在各个国家 之间建设双向道路使得国家之间连通.但是每个国家的国王都很吝啬,他们只愿 意修建恰好 n – 1 条双向道路. 每条道 ...

  6. TopCoder SRM 559 Div 1 - Problem 900 CircusTents

    传送门:https://284914869.github.io/AEoj/559.html 题目简述: n个实心圆,两两没有交集,在第一个圆上找一个点,使得它到另外一个圆上某个点的最短距离的最小值尽量 ...

  7. UVALive - 3530:Martian Mining

    dp 可以发现,对于(i,j),要么把它运上去,那么把它运到左边,枚举一下即可 #include<cstdio> #include<cstdlib> #include<a ...

  8. C++Primer学习——函数

    编译器能以任意顺序对形参进行求值 函数的返回类型不能是数组类型和函数类型. 函数开始时为形参分配内存,一旦函数结束,形参也就被销毁了. 如果弄成静态局部变量,那么回到程序终止结束时才被销毁. void ...

  9. ●HDU 6021 MG loves string

    题链: http://acm.hdu.edu.cn/showproblem.php?pid=6021 题解: 题意:对于一个长度为 N的由小写英文字母构成的随机字符串,当它进行一次变换,所有字符 i ...

  10. hdu 5637 BestCoder Round #74 (div.2)

    Transform  Accepts: 7  Submissions: 49  Time Limit: 4000/2000 MS (Java/Others)  Memory Limit: 131072 ...