How to kill a particular user terminal on Linux
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的更多相关文章
- Process Kill Technology && Process Protection Against In Linux
目录 . 引言 . Kill Process By Kill Command && SIGNAL . Kill Process By Resource Limits . Kill Pr ...
- Linux进程自保护攻防对抗技术研究(Process Kill Technology && Process Protection Against In Linux)
0. 引言 0x1: Linux系统攻防思想 在linux下进行"进程kill"和"进程保护"的总体思路有以下几个,我们围绕这几个核心思想展开进行研究 . 直接 ...
- mac系统terminal连接linux
ssh user@hostname user是管理员账号 hostname是服务器ip
- 【转载】Linux kill, killall, kill -9
1) 查看进程的方法: ps -ef 或者 ps aux root 15087 0.0 0.0 0 0 ? S 23:31 0:00 [kwo ...
- 【Linux常用命令】Linux kill, killall, kill -9,
参考链接 https://blog.csdn.net/zong596568821xp/article/details/77899454 kill + PID kill -9 + PID 加上-9 是 ...
- kill命令
*杀死进程最安全的方法是单纯使用kill命令,不加修饰符,不带标志. 首先使用ps -ef命令确定要杀死进程的PID,然后输入以下命令: # kill -pid 注释:标准的kill命令通 ...
- CentOS 6.6 中设置Terminal快捷键
排版比较乱,参见 https://www.zybuluo.com/Jpz/note/144583 CentOS 6.6 中设置Terminal快捷键 Linux开发环境配置 Terminal是Cent ...
- 【Kill】两条Linux命令彻底杀死Oracle
今天编写的两条极具杀伤力的命令,它可以瞬间将Oracle杀死在无形之中.后面我将给出简单注释并展示一下它的威力.$ ps -ef |grep $ORACLE_SID|grep -v grep|awk ...
- kill 和killall----杀死进程
1.根据进程ip查看进程名 Liunx中 通过进程名查找进程PID可以通过 pidof [进程名] 来查找. 反过来 ,通过PID查找进程名则没有相关命令.但在linux根目录中,有一个/proc的 ...
随机推荐
- Java基础——字符串String
String类 1. String类位于java.lang包中,使用时无需导包. 2. 创建字符串的两种方式: ① 直接指定(字面量声明):String str = "abc"; ...
- 【推荐】CentOS安装gcc-4.9.4+更新环境+更新动态库
注:以下所有操作均在CentOS 6.8 x86_64位系统下完成. CentOS上yum安装的gcc版本过低(4.4.7),在安装某些软件的时候不支持,所以这里需要对其进行升级. #gcc的安装# ...
- Swagger+Asp.net WebApi实例
第一步新建WebApi项目 文件-新建-项目,弹出以下页面 第二步,新建参数项目 第三步 1.自定义输入参数 2.定义公用输出参数 3.定义输出参数 4.定义返回模型 第四步,在webapi项目中新增 ...
- [LeetCode] Convert BST to Greater Tree 将二叉搜索树BST转为较大树
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original B ...
- JS点击按钮打开新的独立页面
工作中遇到需要点击按钮弹出一个独立的页面,并显示指定内容的问题,查了一些资料后,得到以下方法: window.open('locationPage.html', '_blank', 'height=1 ...
- 安卓开发JAVA基础之初识JAVA
JAVA的一大特点------不依赖平台 JAVA在平台之上提供了一个JAVA运行环境(Java Runtime Environment, JRE),该环境由Java虚拟机(Java Virtua ...
- [USACO 03FEB]Farm Tour
Description When FJ's friends visit him on the farm, he likes to show them around. His farm comprise ...
- [POI2000] 最长公共子串
给出几个由小写字母构成的单词,求它们最长的公共子串的长度. 任务 从文件中读入单词 计算最长公共子串的长度 输出结果到文件 输入 文件的第一行是整数 n,1<=n<=5,表示单词的数量.接 ...
- Python virtualenv 使用总结篇
一.virtualenv的安装 1.使用pip全局安装virtualenv,建议使用pip 1.3或更高版本,在1.3之前,pip没有通过SSL从PYPI下载. $ [sudo] pip instal ...
- Django中数据查询(万能下换线,聚合,F,Q)
数据查询中万能的下划线基本用法: __contains: 包含 __icontains: 包含(忽略大小写) __startswith: 以什么开头 __istartswith: 以什么开头(忽略大小 ...