linuxwho命令pass

不及物动词 其他 89

回复

共3条回复 我来回复
  • 不及物动词的头像
    不及物动词
    这个人很懒,什么都没有留下~
    评论

    The “who” command in Linux is used to display information about currently logged in users on the system. It provides details such as the username, terminal they are using, login time, and the IP address from which they are connected.

    To use the “who” command, you simply need to open a terminal and type “who” followed by pressing the Enter key. The output will then show a list of users currently logged in.

    Additionally, you can customize the output by using different options with the “who” command. Here are some commonly used options:

    1. “-q” or “–count”: This option displays only the total count of logged in users.

    2. “-a” or “–all”: This option shows all information available, including the username, terminal, date, and time.

    3. “-b” or “–boot”: This option displays the time the system was last booted.

    4. “-r” or “–runlevel”: This option shows the current run level of the system.

    5. “-s” or “–short”: This option provides a shorter output with just the username, terminal, and login time.

    Overall, the “who” command is a useful tool for system administrators to monitor user activity on a Linux system. It helps in identifying who is currently logged in and can assist in troubleshooting and managing user sessions.

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

    The “who” command is a Linux command that is used to display information about users currently logged in to a Linux system. It provides details such as username, terminal, login time, and IP address. By using the “who” command with different options, you can customize the output as per your requirement. Here are the details related to the “who” command:

    1. Syntax:
    The syntax for the “who” command is as follows:
    who [OPTION]… [ FILE | ARG1 ARG2 ]

    2. Display logged-in users:
    By simply typing the “who” command without any options, it will display a list of users currently logged in to the system. The output will include the username, terminal, login time, and IP address.

    3. Customize output:
    The “who” command provides several options to customize the output. Some commonly used options are:
    – “-a” or “–all”: Displays information about all users, including system users.
    – “-q” or “–count”: Displays only the count of logged-in users.
    – “-s” or “–short”: Displays a shorter output with only the username, terminal, and login time.
    – “-u” or “–users”: Displays only the usernames of logged-in users.

    4. Display idle time:
    The “who” command also has options to display the idle time of users. The idle time indicates the duration for which a user has been inactive. Some options to display idle time are:
    – “-i” or “–idle”: Displays the idle time in minutes.
    – “-w” or “–writable”: Displays the idle time in a more readable format.

    5. Retrieve information from a specific file or device:
    By specifying a file or device with the “who” command, you can retrieve information about logged-in users from that specific source. For example, you can use “/var/run/utmp” as the file argument to fetch information from the file that contains the login records.

    These are some of the key points related to the “who” command in Linux. The “who” command is a helpful tool for system administrators to keep track of users’ activity on a Linux system.

    2年前 0条评论
  • worktile的头像
    worktile
    Worktile官方账号
    评论

    在Linux系统中,`who`命令用于显示当前登录到系统上的用户信息。它可以显示用户名、登录的终端设备、登录时间等信息。下面我们来详细了解一下`who`命令的用法和操作流程。

    ## 1. 命令格式和参数

    `who`命令的一般格式为:
    “`shell
    who [OPTION]… [FILE]…
    “`
    常用的参数有:
    – `-a`或`–all`:显示所有用户登录信息(包括系统进程)。
    – `-b`或`–boot`:显示系统启动时间。
    – `-H`或`–heading`:显示列标题。
    – `-q`或`–count`:显示登录用户总数。
    – `-s`或`–short`:显示简略信息。
    – `-i`或`–idle`:显示用户当前空闲时间。
    – `-u`或`–users`:显示当前登录用户的用户名。
    – `-l`或`–lookup`:显示主机名和IP地址。
    – `–version`:显示命令的版本信息。
    – `–help`:显示命令的帮助信息。

    ## 2. 命令示例和操作流程

    ### 2.1 显示登录用户信息

    要显示当前登录用户的信息,只需在终端中执行`who`命令即可:
    “`shell
    who
    “`
    命令执行后,会列出每个登录用户的用户名、登录终端设备、登录时间和登录来源(远程登录IP地址或本地终端设备)等信息。

    ### 2.2 显示登录用户总数

    使用`-q`参数可以显示当前登录用户的总数:
    “`shell
    who -q
    “`
    命令执行后,会输出类似于以下内容的信息:
    “`
    # users=3
    “`
    其中,`users`后的数字表示当前登录的用户总数。

    ### 2.3 显示用户当前空闲时间

    使用`-i`参数可以显示当前登录用户的空闲时间:
    “`shell
    who -i
    “`
    命令执行后,会列出每个登录用户的用户名、登录终端设备、登录时间和空闲时间等信息。

    ### 2.4 显示系统启动时间

    使用`-b`参数可以显示系统的启动时间:
    “`shell
    who -b
    “`
    命令执行后,会输出类似于以下内容的信息:
    “`
    system boot YYYY-MM-DD HH:MM
    “`
    其中,`YYYY-MM-DD HH:MM`表示系统的启动时间。

    ### 2.5 显示登录用户简略信息

    使用`-s`参数可以显示登录用户的简略信息:
    “`shell
    who -s
    “`
    命令执行后,会列出当前登录用户的用户名、终端设备和登录时间等信息,去掉了远程登录IP地址和IDLE信息。

    ### 2.6 显示主机名和IP地址

    使用`-l`参数可以显示登录用户的主机名和IP地址:
    “`shell
    who -l
    “`
    命令执行后,会列出每个登录用户的用户名、登录终端设备、登录时间、主机名和IP地址等信息。

    ### 2.7 显示命令版本和帮助信息

    要显示`who`命令的版本信息,可以使用`–version`参数:
    “`shell
    who –version
    “`
    要显示`who`命令的帮助信息,可以使用`–help`参数:
    “`shell
    who –help
    “`

    以上就是关于`who`命令的基本用法和操作流程的介绍。通过使用不同的参数,可以实现不同的功能。希望对你有所帮助!

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

400-800-1024

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

分享本页
返回顶部