Table of Contents
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
finger command is used without any arguments, it displays the information of currently logged-in users in the system.
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
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
4. Prevent matching the full name of the user
-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
-s option displays the specific user information in the column format or short format.
$ finger -s user
6. finger command to prevent displaying the plan, project, and PGP key detail
-p option prevents the finger from displaying the contents of the '.plan', '.project', and '.pgpkey' files.
$ finger -p
7. Display user information in long format
-l option causes finger to display the information of logged-in users in the long format.
$ finger -l
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
9. Create projects for a user using finger command
The '.project' file in the home directory contains the projects for a user.
$ cat > .project
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
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.