Finger Command in Linux

FREE Online Courses: Click for Success, Learn for Free - Start Now!

In this article, we will learn everything about the finger command in Linux. We will look at the finger command, why it is used, how to install it, the files used by the finger command, and the syntax and options used with it.

In the end, we will also look at ten beautiful practical examples of the finger command to better understand its functioning and options. So pay attention, take notes if you need, and read the entire article for the best benefits.

What is Linux finger command?

The finger command is a command-line-based utility in Linux-based operating systems that gives details of all the users who are logged in. There are various user information lookup commands like “whoami”, “who”, “lastlog”, “users”, and so many more. The finger command is one such user information lookup command.

The finger command is a shear boon for system administrators as it gives various information about users like login name, user name, idle time, login time, and sometimes, their email address.

The finger tool is very similar to the pinky command as they perform similar tasks, like giving information about the currently logged-in users on your Linux or Unix-like operating system. But the truth is that the picky command is just a lightweight version of the finger command.

How to install finger command in Linux?

The finger command does not come preinstalled in most Linux distributions. However, you can always download it with the commands below regarding your Linux distro.

Installing the finger command on Debian-based Linux distributions

If you want to download the finger command on Debian-based Linux distros like Kali, Ubuntu, Deepin, ParrotOS, Mint, MX Linux, Pure OS, AntiX, etc., use the command shown below:

sudo apt install finger

install finger

Installing Linux finger command on RHEL-based Linux distributions

If you want to download the finger command on RHEL-based Linux distros like Clear OS, Oracle Linux, Alma Linux, Rocky Linux, Cent OS, etc., use the command shown below:

sudo yum install finger

Installing the finger command on Fedora-based Linux distributions

If you want to download the finger command on Fedora-based Linux distros like Berry Linux, Qubes, Fedora spins, Clear OS, Korora, Hanthana, Arquetype, etc., use the command shown below:

sudo dnf install finger

Syntax of the finger command

The syntax of the finger command is one of the easiest there is. See for yourself:

finger <options> <user>

Let us look at the fields in the syntax of the finger command:

1. <options>

This field takes in a range of options that specifies how the finger command must function and format the output.

2. <username>

This field specifies the user’s login name on which you want information.

Options used with the finger command

Unlike most of the commands in Linux, the finger command has only a few options associated with it. Let us take a brief look at each one of them:

1. -s

This option displays various information like the user’s login name, real name, and terminal name and writes status, idle time, login time, office location, and office phone number.

2. -l

This option prints various additional information to the one printed by the option “-s”. This additional information consists of the user’s home directory, home phone number, login shell, mail status, and also the contents of the files from the user’s home directory like “.plan”, “.project”, “.pgpkey” and “.forward”.

3. -p

This option prevents the option “-l” of the finger command from displaying the contents of the “.plan”, “.project”, and “.pgpkey” files from the user’s home directory.

4. -m

This option prevents the matching of usernames.

Files used by the finger command

To provide such vivid outputs, the finger command takes the help of the following files from the system.

1. ~/.nofinger
2. ~/.plan
3. ~/.project
4. ~/.pgpkey

Now, since we are done with the basics and theory of the finger command, let’s look at some cool practical commands by pairing them with options to understand their function better.

Displaying the list of logged-in users

If you simply want to list the currently logged-in users, simply execute the “finger” command without any options trailing it.

loggedin users

Displaying information about a specific user

To display the information of a specific user, run the finger command followed by the name of the user you are searching for as shown:

finger <user>

displaying user information

Before proceeding further, let us look at the different fields in the above output to understand the following examples better.

1. Login – Shows the login name of a user
2. Name – Shows the full name of a user
3. Directory – Shows the home directory of a user
4. Shell – Shows the shell used by a user
5. On since – Shows the user’s logged-in time and date
6. Mail – Shows the mails of a user if any
7. Plan – Shows the plans of a user

Prevent matching the full name of the user

Using the finger command along with the option “-m” prevents the finger command from matching a user’s full name. Use the syntax shown:

finger -m <user>

prevent matching

Displaying specific user information in a column

Using the finger command along with the option “-s displays the specific user information in a column or short format. Use the syntax shown:

finger -s <user>

user information

Preventing the printing of plan, project, and PGP key detail

If you don’t want the finger command to display the contents of ‘.plan’, ‘.project’, and ‘.pgpkey’ files from the users home directory, combine the finger command with the option “-p” followed by the username as shown:

finger -p <user>

preventing plan

Displaying user information in long format

If you want to display the login information of users in a long and details manner, execute the finger command along with the option “-l” as shown:

long format

Creating a plan for a user

To create plans for a user, create a “.plan” file on the desktop of the user by using the cat command followed by the redirection operator as shown: “cat > .plan”. Upon typing the content, press the key combination “Ctrl” + “d” and then type the finger command followed by the username to see the updated plan content.

creating plan

Creating a project for a user

To create plans for a user, create a “.project” file on the desktop of the user by using the cat command followed by the redirection operator as shown: “cat > .project”. Upon typing the content, press the key combination “Ctrl” + “d” and then type the finger command followed by the username to see the updated project content.

project

Creating a PGP key for a user

To create plans for a user, create a “.pgpkey” file on the desktop of the user by using the cat command followed by the redirection operator as shown: “cat > .pgpkey”. Upon typing the content, press the key combination “Ctrl” + “D” and then type the finger command followed by the username to see the updated pgpkeycontent.

pgp key

Summary

As you have seen, the finger command is a simple tool that gives us information about logged-in users. This information contains lots of valuable stuff like the user’s login name, real name, terminal name and writes status, idle time, login time, office location, and office phone number.

You have now understood what the finger command is, why it is used, how to uninstall it, the syntax of the finger command, and the options used along with it. We have also seen a few practical examples of the finger command by combining it with various options.

We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *