zoukankan      html  css  js  c++  java
  • linux下注销其它用户或者tty的命令

    需求:
    假设w输出类似这样
    user1   pts/0    ...................... -bash
    user1    pts/1    ...................... -bash
    user2    pts/2   ...................... -bash
    user2    pts/3    ...................... w

    有没有命令对指定的tty注销用户?又有没有命令对指定的用户注销所有tty?

    总感觉用ps kill -9 太暴力了点,也不方便......

    其实可以通过skill命令来实现:
    # skill
    Usage:   skill [signal to send] [options] process selection criteria
    Example: skill -KILL -v pts/*

    The default signal is TERM. Use -l or -L to list available signals.
    Particularly useful signals include HUP, INT, KILL, STOP, CONT, and 0.
    Alternate signals may be specified in three ways: -SIGKILL -KILL -9

    General options:
    -f  fast mode            This is not currently useful.
    -i  interactive use      You will be asked to approve each action.
    -v  verbose output       Display information about selected processes.
    -w  warnings enabled     This is not currently useful.
    -n  no action            This only displays the process ID.

    Selection criteria can be: terminal, user, pid, command.
    The options below may be used to ensure correct interpretation.
    -t  The next argument is a terminal (tty or pty).
    -u  The next argument is a username.
    -p  The next argument is a process ID number.
    -c  The next argument is a command name.
    -t 这个参数可以多利用

  • 相关阅读:
    QTreeWidget创建
    Qt QTreeWidget节点的添加+双击响应+删除详解(转)
    Qt QTreeWidget 树形结构实现(转)
    QMessageBox类学习:
    QAction类详解:
    Qt事件和信号的区别 .
    Qt消息机制和事件(二)
    Qt消息机制和事件(一)
    初步开始学习图
    图中最短路径算法(Dijkstra算法)(转)
  • 原文地址:https://www.cnblogs.com/lindafu/p/4849392.html
Copyright © 2011-2022 走看看