"> How to Use the finger Command on Linux - Engr Kabir Saleh

How to Use the finger Command on Linux

A terminal window on an Ubuntu-style Linux desktop
Fatmawati Achmad Zaenuri/Shutterstock.com

Knowing who is using your Linux or Unix-like system is a fundamental part of managing it. Pointing at someone might be considered rude, but using your finger can still be enlightening.

The finger command almost certainly isn’t installed by default in your Linux distribution. It was absent on the Ubuntu, Fedora, and Manjaro distributions used to research this article.  We’ve already covered the pinky command, which is the lightweight version of finger. pinky is supplied by default, but if you want to use fingerYou, yed to install it.

The finger and pinky commands perform the same sort of task. They both tell you some information about the currently logged in users on your Linux or Unix-like operating system. The sets of information they each provide are slightly different and pinky has a few more options to progressively prune out the bits you might not want to see.

If you want to have your Linux setup up to be more “Unix-like” than “Linux-like,” you might want to use finger. Perhaps you have inherited some scripts that expect finger to be available.  But regardless of the reason if you are forced to—or just prefer to—use finger, here is how to install it and use it.

RELATED: How to Use the pinky Command on Linux

Installing finger

You can install finger on Ubuntu with this command:

sudo apt-get install finger

sudo apt-get install finger in a terminal window

To install finger on Fedora, use this command:

sudo dnf install finger

sudo dnf install finger in a terminal window

On Manjaro you need to install fingerfrom the Arch User Repository (AUR), and build it from its source code. There are tools to do this for you, so it is an automated process. That’s great, but it does mean you must have those tools installed on your Manjaro system, as well as a tool to retrieve and install finger from the AUR. So we’ll need to install those first.

If you don’t already have a suitable AUR installer on your system, trizen is a decent option. This command will install it.

sudo pacman -Syu trizen

sudo pacman -Syu trizen in a terminal window

Before we can use trizen to install finger for us, we need to install some development tools. These are called automatically by the install and build scripts that trizen will call to install finger on your system. Of course, if you’ve installed items from the AUR before, or if you do any software development, you’ll likely already have these installed.

We need to install the GNU C library. We do so with this command:

sudo pacman -Syu glibc

sudo pacman -Syu glibc in a terminal window.

We also need the GNU Binutils. These are used by the gcc compiler:

sudo pacman -Syu binutils

sudo pacman -Syu binutils in a terminal window

The installation process also makes use of the patch utility. This command will install it:

sudo pacman -Syu patch

sudo pacman -Syu patch in a terminal window

The make utility is used to control the actual compile and build of finger from its source code. Install it with this command:

sudo pacman -Syu make

sudo pacman -Syu make in a terminal window.

And of course, we won’t achieve any success in building something from source code without a compiler. We’ll definitely need gcc, the GNU Compiler Collection. This command will install it for you:

sudo pacman -Syu gcc

sudo pacman -Syu gcc in a terminal window

And finally, with the build dependencies met, and trizen installed, we can issue the command to actually install finger.

trizen -S netkit-bsd-finger

trizen -S netkit-bsd-finger in a terminal window.

As the installation progresses, you’ll be presented with various questions. Just press “Enter” to accept the defaults.

Using finger

Typing finger and hitting “Enter” causes finger to generate its default output.

finger

finger command and output in a terminal window

This displays a single line of information about each of the people who are logged in. The columns are:

  • Login: The user account name of the person who is logged in.
  • Name: The full name of the person, if this is known to the system.
  • Tty: The type of terminal they are logged in at. This will usually be a pts (a pseudo-teletype). “:0” means the physical keyboard and screen connected to the computer.
  • Idle: The idle time of the user. If it is a single digit, it means minutes. If a colon is present, it means hours and minutes, and if a “d” is present, it means days and hours.
  • Login Time: The time the person logged in.
  • Office: This is a historical hangover. It was used to display the name or number of the room in which the person worked. This is very rarely set up by root nowadays. Instead, finger will display the ip address of the machine the user has logged in from.  “:0” means the physical keyboard and screen connected to the computer.
  • Office Phone: This is another legacy item. If root hasn’t recorded the office phone number for a person, it will show a blank.

RELATED: What is a TTY on Linux? (and How to Use the tty Command)

Using finger With One User

To see the details of a single person, pass their account name on the command line.

finger alec

finger alec in a terminal window

When finger works on a single user, it provides a longer display. We get some additional information.

  • Directory: The person’s home directory.
  • Shell: The shell they are using.
  • On Since: The time and date the user logged in, from which tty and which IP address.
  • Mail: If they have mail this is shown. If they have recently checked their mail, the time they checked it is shown. Alec has no mail waiting for him.
  • Plan: If the user creates a “.plan” and “.project” file in their home directory, and puts a bit of text inside them describing what they are working on, the contents of those files will be shown here. This is a system that is very rarely used today. We are told Alec has no plan. That’s not an indictment on his career strategy, it means he hasn’t bothered updating his “.plan” file.

If we repeat this command take a look at Mary, we’ll see that she has been diligent and has put some descriptive text in her “.plan” and “.project” files.

finger mary

finger mary in a terminal window

Using finger With Real Names

You can use a person’s real name with finger . If you can’t recall their account name, use their real name.

finger alec tumovit

finger alec tumovit in a terminal window

As a bonus, you get to find out their account name.

Omitting the .plan and .project FIles

If you don’t want to see the “.plan” and “.project” file summaries, use the -p (no plan) option.

finger -p mary

finger -p mary ina terminal window

Although Mary has active “.plan” and “.project” files, finger ignores them and does not report on their contents.

Using the Long Listing Option

To see a list of all users in the long format display, use the -l (long format) option.

finger -l

finger -l in a terminal window

This makes finger list all of the logged in users in the long display format.

Output from the finger long listing command in a terminal window

Raise your pinky Or Point Your finger

As is often the case, Linux gives you choices. You can use pinky , or you can use finger.

The real difference between them is the extra finesse that pinky has in allowing you to be quite granular in removing the data you’re not interested. And of course, it is pre-installed.





Source link