Linux users Command

February 14, 2021 in Tutorial2 minutes

What is Linux users Command?

In this tutorial we learn how to use users command in Linux. users command print the user names of users currently logged in to the current host.

users Syntax

users [OPTION]... [FILE]

Using users command in Linux

We can pass a file to be read by users command. By default users command will read file /var/run/utmp.

users
vagrant

We can also pass the utmp file to users command and the output will be the same.

users /var/run/utmp
vagrant

Manual Page / Info Page of users Command

We can use man and info command to see the manual page of users command.

users command also have --help option to show list of options.

man page of the users command can be opened using the command below. To exit man or info page you can press q.

man users

info page for users command can be opened using the command below.

info users

To open help page from users command we can run command below.

users --help

Linux users Command Source Code

You can find users command source code from the folowing repositories:

  • [GitHub] GNU Coreutils users command source code](https://github.com/coreutils/coreutils/blob/master/src/users.c)
  • users source code on GNU Savannah cgit
  • [GNU Savannah gitweb] users command source code on](https://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/users.c;h=4acf5f44d96925d278d19dc495146bc8e326bb65;hb=refs/heads/master)

You can read tutorials of related Linux commands below:

Summary

In this tutorial we learn how to use users in Linux with practical examples. Visit our Linux Commands guide to learn more about using command line interface in Linux.