The finger command is used to get all information about system users. With it, we get information such as login name, user name, login time, idle time, and much more. We look at commonly used finger commands in Linux.
Table of contents.
We use the finger command to print out information about system users.
In Linux, in order for the finger to do its job, it needs this information, this information is stored in the following files:
- /usr/bin/finger - stores the finger command.
- /etc/utmp - stores a list of currently logged in users.
- /etc/passwd - stores user accounts, their names and passwords and home directories.
- /etc/security/passwd - stores encrypted user passwords.
- /var/adm/lastlog - stores information about login times.
- $HOME/.plan - stores a short description of a user's plan.
- $HOME/.project - stores a user's project assignment.
The last two are optional files.
If finger is not installed. We can install it by writing:
First, we update the system repositories and packages then install them:
Debian and Ubuntu:
$ sudo apt-get update $ sudo apt-get upgrade # install finger $ sudo apt-get install finger
$ sudo dnf update # install finger $ sudo dnf install finger
finger commands are in the following format:
$ finger [-lmsp] [user ...] [user@host ...]
Commonly used flags are:
- -i, for printing out a quick listing that includes idle times.
- -b, for a brief long listing.
- -q, -l, these are used for listing, the first prints out a short quick listing while the second a long-form listing.
- -p, -j these two are used to suppress printing out of optional files, first .plan files, the latter, .project files.
finger command can also be used to get details about remote users of the system, some of the commonly used parameters are:
user - to get details of a user from the /etc/passwd file.
@hostname - here we specify logged-in hosts on a remote host
user@hostname - here we get details for a specific user on a remote host
We have a user root to get details of this user we write:
$ finger root
Here we get information about a user such as a name, the user's home directory, the shell being used by the user, the last login time, and any mails if the user has them. Optional files such as the plan show the user's created plan.
To print out information in a long list we use the -l option:
$ finger -l root
We can also get login details of the user including the idle status:
$ finger -s root
IF we don't want to print out the .plan or .project files' content we suppress them since they may have the information we want to be omitted from the output:
To suppress .plan and .project files, we write:
$ finger -p root
We use the finger command to get information about system users, both local and remote. We have looked at the finger command, commonly used options, parameters and commands.
We may execute the command $ man finger for the command's manual page.