TrumanWong

users

Print the names of all logged-in users on the current host.

Summary

users [OPTION]... [FILE]

The main purpose

  • Each displayed username corresponds to one login session; if a user has more than one login session, his username will be displayed the same number of times.

Options

--help Display help information and exit.
--version Display version information and exit.

Parameters

FILE (optional): A file that records the user's current login status; /var/run/utmp and /var/log/wtmp are used by default.

return value

Returning 0 indicates success, returning a non-zero value indicates failure.

example

[root@localhost ~]# users
root root

Notice

  1. This command is a command in the GNU coreutils package. For related help information, please see man -s 1 users, info coreutils 'users invocation'.