- Unix Commands Reference
- Unix Commands - Home
finger Command in Linux
The finger command in Linux displays the information about local and remote users. It displays the login name, real name, terminal, idle time, login time, and office details. It can also display information about a specific user. It retrieves information from the /etc/passwd file.
The finger command gives detailed information about users compared to other similar utilities such as who, w, and id. It is essentially used to identify and monitor the connected users.
Table of Contents
Here is a comprehensive guide to the options available with the finger command −
- Prerequisites to Use finger Command
- Syntax of finger Command
- Options of finger Command
- Examples of finger Command in Linux
- Creating Plan, Project, and PGP Key Files
Prerequisites to Use finger Command
The finger command may not be installed by default in Linux. To check if it is available, use the command given below −
which finger
If the above command shows the output with the path of the command’s binary, then it is installed. If no output is shown, install the finger command using the instructions below.
To install the finger command on Ubuntu, Kali Linux, Debian, and Debian-based distributions, use the following command −
sudo apt install finger
To install it on CentOS and RHEL, use −
sudo yum install finger
To install the finger command on Fedora, use −
sudo dnf install finger
Syntax of finger Command
The syntax of the Linux finger command is as follows −
finger [options] [user|user@host]
The [options] field specifies the options to modify the command’s behavior, while the [user|user@host] field is used to specify the user’s name or user with the hostname.
Options of finger Command
The options for the Linux finger command are listed below −
Options | Description |
---|---|
-l | It is used to display the information in a long listing format |
-m | It is used to prevent the matching of real names |
-p | It is used to skip the .project, .plan, and .pgpkey files |
-s | It is used to display the information in the short listing format (default) |
Examples of finger Command in Linux
This section demonstrates the usage of the finger command in Linux with examples −
- Displaying Information of All Connected Users
- Displaying Information of All Users in a Long Listing Form
- Displaying Information of a Specific User
- Displaying Information of a Specific User in Short Listing Form
- Displaying User Information Skipping Project and Plan Details
- Displaying User Information Skipping Real Name Match
Displaying Information of All Connected Users
To display the information of all connected users, execute the finger command without any option −
finger
The output image shows that currently, three users are connected.
Displaying Information of All Users in a Long Listing Form
To display the information of all users in the long listing format, use the -l option with the finger command −
finger -l
Displaying Information of a Specific User
To display information about a specific user, mention the user’s name.
finger alex
To display information about the root user, use −
finger root
Displaying Information of a Specific User in Short Listing Form
To display the information of a specific user in a short listing format, use the -s option −
finger -s alex
Displaying User Information Skipping Project and Plan Details
The finger command displays the project, plan, and PGP key details by default in the long list format.
To skip the PGP key, project, and plan details, use the -p option −
finger -p sam
Displaying User Information Skipping Real Name Match
The real names of multiple users can be the same. The finger command might display details of all the users with the same real name as shown in the following output.
To avoid this scenario, the -m option is used −
finger -m alex
Creating Plan, Project, and PGP Key Files
The plan, project, and PGP key files are manually created in the user's home directory.
sudo nano .plan sudo nano .project sudo nano .pgpkey
Open the files and add the details.
Conclusion
The finger command in Linux is used to display the user information of all local and remote users. It is a handy tool to get detailed information on connected users. Moreover, it can be more useful for managing user information than similar command-line utilities.
In this tutorial, we explained the finger command, its installation, syntax, options, and usage in Linux through examples.