users command in Linux is used to display the list of all logged-in users on the current host. This command is useful for system administrators to check the number of users currently logged in and their usernames.
The syntax for the
users command is as follows:
users [OPTION]... [FILE]
users command without any options or arguments displays the list of usernames of all logged-in users on the current host, separated by spaces.
$ users johndoe janedoe
users command can also take a file as an argument and display the list of users who are logged in on the specified terminal or pseudo-terminal.
$ users /dev/pts/0 johndoe janedoe
The following table lists the available options for the
|-q, –count||Displays the number of logged-in users instead of their usernames.|
|-s, –seconds||Displays the date and time when each user logged in.|
|-u, –help||Displays the help message and exits.|
|–version||Displays the version information and exits.|
users command is not displaying any output, it may be because there are no users logged in on the current host. Alternatively, it could be due to incorrect usage of the command or a system issue.
users command is displaying an error message, it is recommended to check the syntax and usage of the command. It may also be helpful to consult the command’s manual page by running
userscommand only displays the usernames of logged-in users and does not provide any additional information such as their IP address or location.
userscommand may not display the complete list of logged-in users if the system is configured to hide certain users or if the user has set their account to be hidden from other users.