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. Java并发编程之Lock

    重入锁ReentrantLock 可以代替synchronized, 但synchronized更灵活. 但是, 必须必须必须要手动释放锁. try { lock.lock(); } finally ...

  2. 深入解析浏览器的幕后工作原理(三) 呈现树和 DOM 树的关系

    呈现树和 DOM 树的关系 呈现器是和 DOM 元素相对应的,但并非一一对应.非可视化的 DOM 元素不会插入呈现树中,例如"head"元素.如果元素的 display 属性值为& ...

  3. 一、spring的成长之路——代理设计模式

    java常用的设计模式详解: 1.代理模式(JDK的动态代理) [IDept.java] ​ 这是一个简单的就接口,进行数据的更新 package com.itcloud.pattern.proxy; ...

  4. ASP.NET MVC-异常处理&自定义错误页

    一.应用场景 对于B/S应用程序,在部署到正式环境运行的过程中,很有可能出现一些在前期测试过程中没有发现的一些异常或者错误,或者说只有在特定条件满足时才会发生的一些异常,对于使用ASP.NET MVC ...

  5. codevs 搜索题汇总(黄金级)

    2801 LOL-盖伦的蹲草计划  时间限制: 1 s  空间限制: 256000 KB  题目等级 : 黄金 Gold   题目描述 Description 众所周知,LOL这款伟大的游戏,有个叫盖 ...

  6. [POI2007]ZAP-Queries

    题目描述 Byteasar the Cryptographer works on breaking the code of BSA (Byteotian Security Agency). He ha ...

  7. [Codeforces]856D - Masha and Cactus

    题目大意:给出一棵树和若干条可以加入的边,要求加入若干条边使图是仙人掌并且加入的边权和最大,仙人掌定义为没有一个点属于超过1个环.(n,m<=200,000) 做法:这题的仙人掌跟平时见到的不太 ...

  8. hdu 5880 AC自动机

    Family View Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total ...

  9. [LCA模版] Distance Queries

    题目描述 约翰的奶牛们拒绝跑他的马拉松,因为她们悠闲的生活不能承受他选择的长长的赛道.因此他决心找一条更合理的赛道.此题的输入于第一题相同,紧接着下一行输入一个整数K,以后K行为K个"距离问 ...

  10. bzoj4518[Sdoi2016]征途 斜率优化dp

    4518: [Sdoi2016]征途 Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 1657  Solved: 915[Submit][Status] ...