linux命令who

worktile 其他 53

回复

共3条回复 我来回复
  • worktile的头像
    worktile
    Worktile官方账号
    评论

    Linux命令`who`用于显示当前登录系统的用户信息。

    该命令的常用选项包括:
    – `-a`:显示所有用户,包括空闲用户
    – `-d`:显示并统计不活动的用户
    – `-H`:以HTML格式显示输出
    – `-q`:仅显示登录用户的数量
    – `-r`:显示用户的运行等级(run level)
    – `-s`:仅显示当前登录用户的信息
    – `-T`:显示用户的时间和终端信息
    – `-u`:显示登录用户的详细信息
    – `-b`:仅显示已登录系统的用户信息
    – `-l`:显示详细的登录信息

    在不加任何选项的情况下,使用`who`命令会显示登录系统的用户列表,包括用户名、终端、登录时间等信息。例如:
    “`
    $ who
    bob tty1 2020-01-01 08:30
    alice pts/2 2020-01-01 09:15 (:0)
    “`

    除了单纯地显示用户列表,`who`命令还可以结合其他命令进行过滤和处理。例如,可以使用管道符将`who`的输出传递给`grep`命令来过滤特定用户的信息:
    “`
    $ who | grep bob
    bob tty1 2020-01-01 08:30
    “`

    总结:
    `who`命令是Linux系统中用于显示当前登录用户信息的命令。通过添加不同的选项,可以实现不同的输出效果,如显示所有用户、显示用户的详细信息等。该命令在管理系统用户和监控系统登录情况时非常有用。

    2年前 0条评论
  • fiy的头像
    fiy
    Worktile&PingCode市场小伙伴
    评论

    The “who” command is a command in Linux system that allows users to display information about the currently logged-in users. Here are five key points about the “who” command:

    1. Basic Usage: The basic syntax of the “who” command is simply “who” followed by any available options. Running the command without any options will display a list of all currently logged-in users. For example, running “who” in the command line will display a list of usernames, terminal numbers, login times, and IP addresses or device names.

    2. Options: The “who” command offers several options to customize the output. Some commonly used options include:
    – “-a” or “–all”: Displays all information, including system boot time and run-level.
    – “-b” or “–boot”: Displays the time when the system was last rebooted.
    – “-r” or “–runlevel”: Displays the current run-level of the system.
    – “-s” or “–short”: Displays a shorter output, showing only the username, terminal, and login time.
    – “-u” or “–users”: Displays the number of currently logged-in users.

    3. Determining Idle Time: The “who” command can also be used to determine how long a user has been idle. By using the “-T” option, the command will display the idle time of each user. Idle time is measured in minutes and represents the time since the user last interacted with the system.

    4. Remote Connections: The “who” command can be used to identify remote connections to the system. By using the “-m” option, the command will display the hostname or IP address of the machine from which the user is logged in. This can be useful for system administrators to identify potential unauthorized access.

    5. Removing Users: The “who” command can also be combined with other commands to remove specific users from the output. For example, by piping the output of “who” to the “grep” command, it is possible to filter out specific usernames or patterns. For instance, running “who | grep john” will display only the logged-in users with the username “john”.

    In summary, the “who” command in Linux is a powerful tool to display information about currently logged-in users. It provides details such as usernames, terminal numbers, login times, and IP addresses. Additional options can be used to customize the output and filter specific information.

    2年前 0条评论
  • 不及物动词的头像
    不及物动词
    这个人很懒,什么都没有留下~
    评论

    Linux命令”who”用于显示当前登录系统的用户信息。它可以提供以下信息:
    1. 登录的用户名
    2. 登录的终端设备
    3. 登录的IP地址或主机名
    4. 登录时间
    5. 距离上次活动的时间

    以下是对Linux命令”who”的详细说明:

    ## 语法
    who [选项] [文件]

    ## 选项
    * -a, –all:列出所有登录用户,包括系统用户。
    * -b, –boot:显示系统启动的时间。
    * -d, –dead:显示已经注销的用户。
    * -H, –heading:显示列名。
    * -l, –login:显示仅登陆用户。
    * -m, –message:显示正在使用的电脑信息。
    * -q, –count:仅显示登录用户的数量。
    * -r, –runlevel:显示运行级别。

    ## 实例

    ### 1. 显示当前登录用户的信息
    命令:
    “`
    who
    “`

    输出示例:
    “`
    user1 tty1 2021-06-01 10:00
    user2 pts/0 2021-06-01 11:30 (192.168.1.100)
    “`

    ### 2. 显示系统启动时间
    命令:
    “`
    who -b
    “`

    输出示例:
    “`
    system boot 2021-06-01 09:00
    “`

    ### 3. 显示登录用户的数量
    命令:
    “`
    who -q
    “`

    输出示例:
    “`
    #users=2
    “`

    ### 4. 显示列名
    命令:
    “`
    who -H
    “`

    输出示例:
    “`
    NAME LINE TIME COMMENT
    user1 tty1 2021-06-01 10:00
    user2 pts/0 2021-06-01 11:30 (192.168.1.100)
    “`

    ### 5. 显示运行级别
    命令:
    “`
    who -r
    “`

    输出示例:
    “`
    run-level 2 Jun 1 09:00
    “`

    ### 6. 显示已经注销的用户
    命令:
    “`
    who -d
    “`

    输出示例:
    “`
    user3 tty2 2021-06-01 10:15
    “`

    ### 7. 显示正在使用的电脑信息
    命令:
    “`
    who -m
    “`

    输出示例:
    “`
    user1 tty1 2021-06-01 10:00 (192.168.1.101)
    “`

    2年前 0条评论
注册PingCode 在线客服
站长微信
站长微信
电话联系

400-800-1024

工作日9:30-21:00在线

分享本页
返回顶部