zoukankan      html  css  js  c++  java
  • linux查看用户登录信息2-who命令

    who命令与w命令相似,但要比w命令显示更加详细的信息。
    [root@rusky opt]# man who
    WHO(1) User Commands WHO(1)

    NAME
    who - show who is logged on

    SYNOPSIS
    who [OPTION]... [ FILE | ARG1 ARG2 ]

    DESCRIPTION
    Print information about users who are currently logged in.

    -a, --all
    same as -b -d --login -p -r -t -T -u

    -b, --boot
    time of last system boot

    -d, --dead
    print dead processes

    -H, --heading
    print line of column headings

    -l, --login
    print system login processes

    --lookup
    attempt to canonicalize hostnames via DNS

    -m only hostname and user associated with stdin

    -p, --process
    print active processes spawned by init

    -q, --count
    all login names and number of users logged on

    -r, --runlevel
    print current runlevel

    -s, --short
    print only name, line, and time (default)

    -t, --time
    print last system clock change

    -T, -w, --mesg
    add user's message status as +, - or ?

    -u, --users
    list users logged in

    --message
    same as -T

    --writable
    same as -T

    --help display this help and exit

    --version
    output version information and exit
    ============
    常用who命令:

    [root@rusky opt]# who 
    root pts/0 Dec 31 14:13 (192.168.1.111)
    rusky1 pts/1 Dec 31 15:58 (192.168.1.111)
    rusky1 pts/2 Dec 31 16:00 (192.168.1.111)
    
    [root@rusky opt]# who -b               --time of last system boot
    system boot Dec 27 05:06
    
    [root@rusky opt]# who -r               ---print current runlevel
    run-level 5 Dec 27 05:06
    
    [root@rusky opt]# who -q               ---all login names and number of users logged on
    root rusky1 rusky1
    # users=3
    
    [root@rusky opt]# who -s
    root pts/0 Dec 31 14:13 (192.168.1.111)
    rusky1 pts/1 Dec 31 15:58 (192.168.1.111)
    rusky1 pts/2 Dec 31 16:00 (192.168.1.111)
    
    [root@rusky opt]# who -a
    system boot Dec 27 05:06
    run-level 5 Dec 27 05:06
    LOGIN tty3 Dec 27 05:06 3508 id=3
    LOGIN tty2 Dec 27 05:06 3506 id=2
    LOGIN tty4 Dec 27 05:06 3510 id=4
    LOGIN tty5 Dec 27 05:06 3514 id=5
    LOGIN tty6 Dec 27 05:06 3516 id=6
    root + pts/0 Dec 31 14:13 . 31733 (192.168.1.111)
    rusky1 + pts/1 Dec 31 15:58 00:33 581 (192.168.1.111)
    rusky1 + pts/2 Dec 31 16:00 00:39 581 (192.168.1.111)
    pts/3 Dec 31 16:21 1084 id=ts/3 term=0 exit=0
  • 相关阅读:
    L1-061 新胖子公式 (10 分)
    L1-060 心理阴影面积 (5 分)
    L1-059 敲笨钟 (20 分)
    Linux高性能服务器编程—进程池和线程池
    epoll系列系统调用
    18.5.2 多线程并发服务器端的实现
    10.4 基于多任务的并发服务器
    侯捷C++(complex类)
    Qt 事件机制
    C++篇49问49答
  • 原文地址:https://www.cnblogs.com/rusking/p/4196066.html
Copyright © 2011-2022 走看看