Introduction to finger command
Linux is a multi-user operating system. Several users can use a single system at the same time. It is important to have the system's user information. finger is a command-line utility in Linux which displays the user information. It displays the user’s login name, real name, terminal type, idle time, login time, office location, and office number. finger command is mostly helpful for system administrators to view the information about system users.
How to install finger
finger is not installed by default in any Linux distribution. You can install finger using the following command according to your Linux distribution.
To install finger on CentOS, Fedora, and RHEL
$ sudo yum install finger
To install finger on Ubuntu and Debian
$ sudo apt install finger
Syntax to use finger command in Linux
The syntax for finger
command is as follows:
$ finger [option]
Different examples to use finger command
1. Display list of logged in user
When finger
command is used without any arguments, it displays the information of currently logged-in users in the system.
$ finger
Sample Output:
2. Display information of the specific user (using short name)
finger
command takes the name of a user as input and displays the information of that user.
$ finger user
Sample Output:
It displays the following information.
- Login: the login name of a user
- Name: the full name of a user
- Directory: the home directory of a user
- Shell: the shell used by a user
- On since: the user's logged-in time and date
- Mail: show mails of a user if any
- Plan: shows plans of a user
Users can have plans by creating a '.plan' and '.project' file in their home directory. Anything you write in the file will appear in the Plan field.
3. Display user information using the full name
You can also display the user information by using the full name of a user.
$ finger full_name
Sample Output:
4. Prevent matching the full name of the user
The -m
option prevents finger from matching the full name of a user.
golinux@ubuntu-PC:~$ finger -m parker
finger: parker: no such user.
5. Display the specific user information in column
The -s
option displays the specific user information in the column format or short format.
$ finger -s user
Sample Output:
6. finger command to prevent displaying the plan, project, and PGP key detail
The -p
option prevents the finger from displaying the contents of the '.plan', '.project', and '.pgpkey' files.
$ finger -p
Sample Output:
7. Display user information in long format
The -l
option causes finger to display the information of logged-in users in the long format.
$ finger -l
Sample Output:
8. Create a plan for a user using finger command
You can create plans for a user by creating the '.plan' file in the home directory of a user.
$ cat > .plan
Sample Output:
9. Create projects for a user using finger command
The '.project' file in the home directory contains the projects for a user.
$ cat > .project
Sample Output:
10. Create PGP key for a user
You can create a custom PGP key for a user by creating '.pgpkey' file in the user's home directory.
$ cat > .pgp
Sample Output:
Conclusion
In this tutorial, we have shown you how to use finger command in Linux. finger is a useful command to get information about users in the Linux system. If you still have any confusion, feel free to ask us in the comment section.
As an alternative, you can use pinky command (the lightweight version of finger), which also prints user information.
What's Next
cat command examples for beginners [cheatsheet]
15 usermod command examples in Linux [Cheat Sheet]
Further Reading
man page for finger command
man page for pinky command