3

Kill tty/pts sessions in Linux

 2 years ago
source link: https://gist.github.com/holmberd/b09fb15e9a49d60ac44ea7ff6fb1b6bb
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Kill user tty/pts sessions in Linux

Commands

  • w: show who is logged on and what they are doing
  • who: show who is logged on
  • tty: show current users pseudo terminal
  • ps -ft pts/1: get process id for the pseudo terminal
  • pkill: signal process based on name and other attributes
  1. Check active users logged into the server with: w
 16:53:37 up 23:46,  2 users,  load average: 0.00, 0.00, 0.00
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
ubuntu   pts/1    24.69.132.96     16:45    0.00s  0.04s  0.00s w
ubuntu   pts/2    24.69.132.96:S.0 16:35   16.00s  0.02s  0.02s /bin/bash
  1. Get the PID (Process ID) of a connected terminal (tty) with: ps -ft pts/1
UID        PID  PPID  C STIME TTY          TIME CMD
ubuntu   28580 28102  0 16:45 pts/1    00:00:00 -bash
ubuntu   29081 28580  0 16:55 pts/1    00:00:00 ps -ft pts/1
  1. Kill the process: kill 28580

  2. Alternatively use pkill -t pts/1


Recommend

  • 12
    • ptsjs.org 6 years ago
    • Cache

    Pts.js

    Pts is a javascript library for visualization and creative-coding.

  • 20
    • arthurchiao.github.io 4 years ago
    • Cache

    [译] TTY 的前世今生(2008)

    [译] TTY 的前世今生(2008) Published at 2019-12-08 | Last Update 2019-12-08 本文翻译自 2008 年的一篇帖子 The TTY demysti...

  • 23
    • icyphox.sh 4 years ago
    • Cache

    Five days in a TTY

    I installed KISS Linux This new semester has been pretty easy on me, so far. I hardly every have any classes (again, so far), and I’ve a ton of free time on my hands. This calls for—yep—a distro hop! ...

  • 4
    • www.cnblogs.com 3 years ago
    • Cache

    十一、UART&TTY驱动

    Linux系统中UART驱动和TTY驱动两者有着紧密的关系,它们不像I2C和SPI驱动是单独一个模块,分析时应当将它们看成一个整体来分析。UART驱动部分依赖于硬件平台,而TTY驱动和具体的平台无关。本文的分析内容基于IMX6DL硬件平台和Kernel 3.0.35版本,...

  • 5
    • haydenjames.io 2 years ago
    • Cache

    How to Kill Inactive SSH Sessions

    So, you’ve been disconnected from your server a couple of times, resulting in inactive ssh sessions. You know this because when you use the “w” command, you see something like the following… 22:47:28 up 315 days, 21:...

  • 5
    • teobler.com 2 years ago
    • Cache

    Story Pts Vs Man Days

    故事点 VS 人天by Teobler on 19 / 12 / 202118 viewsback在敏捷实践中,故事点是用来估算

  • 6

    谈到 Linux 和 UNIX 时,你一定听说过 “TTY” 这个术语,但是,这玩意是什么?来源:https://linux.cn/article-14093-1.html...

  • 4
    • www.myfreax.com 2 years ago
    • Cache

    Linux tty的由来与理解 | myfreax

    从UNIX到Linux,您一定听说过“TTY”这个词。作为桌面用户,你应该会用到它,并且你经常使用它。在教程中,让我提及让您熟悉Linux中的术语TTY所必需的一切。请注意,对此没有明确的答案,但它与过去输入/输出设备的交互方式有关。因此,您必须了解一些历史才能获...

  • 7

    Linux tty Command Tutorial for Beginners (with Examples) In Linux, everything is a file. Even every hardware device connected to the system is represented as a special file. So it should come as no surprise that a terminal is a...

  • 6

    Coinstore Partners with PTS Token for Listing on our platform.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK