Beginners Guide for Pinky Command in Linux

Linux TLDR
Last Updated:
Reading time: 4 minutes

Want to find out all the users who logged into your system? Don’t raise your finger; raise your pinky instead.

Confused about what I am talking about? Let me explain what I mean. In Linux, there are numerous tools to show you all the logged-in users on the target machine, including built-in and external tools.

The finger is one of the external tools used to list all of the logged-in users in the target machine, and fetching user related information like home directories, default shells, home phone numbers, etc. is part of this tool.

Unfortunately, this tool is not shipped by default in many Linux distributions (although it is available in many Linux repositories), but you don’t have to be downhearted as you can utilize its alternative pinky.

Tutorial Details

DescriptionPinky: An Alternative to the Finger
Difficulty LevelLow
Root or Sudo PrivilegesNo
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Prerequisitespinky
Internet RequiredNo

What is β€œPinky” in Linux?

The pinky is a lightweight and modern version of the finger tool that ships out of the box for most Linux distributions like Ubuntu, Fedora, and Manjaro, unlike the finger.

Yet, some Linux distributions may not include this tool, which you can install by following the next section.

How to Install Pinky in Linux

If, out of the blue, this command went missing or was not installed in your system, then execute any one of the following commands to install it on your Linux system.

$ sudo apt install pinky                                                                                   #On Debian and Ubuntu
$ sudo dnf install pinky                                                                                   #On Red Hat and Fedora
$ sudo pacman -S pinky                                                                                 #On Arch and Manjaro

After the installation is complete, you can jump to the next section to learn more about this tool.

Usage of the Pinky Command

The pinky command takes two arguments (identically to finger), one for the option and the other for the username.

$ pinky [OPTION] [USERNAME]

When this command is run without any options or usernames, the following output will be shown:

Pinky command output

As you can see from the above picture, three (β€œlinuxtldrβ€œ, β€œdavidβ€œ, and β€œjakeβ€œ) users are connected to the target machine.

The following is an explanation of all the fields mentioned in the above output.

  • Login: The user’s account name.
  • Name: The full (or real) name of the corresponding user.
  • TTY: How users connected to the target machine, locally (tty) or remotely (pts).
  • Idle: Idle (or inactivity) of the user.
  • When: Date and time when the user logged-in to the system.
  • Where: The hostname or IP address of the user’s system.

If you have ever used the finger command, then you can easily figure out that both of these commands return the same output.

Reporting on a Single User

By default, the pinky reports all the user’s information that is logged in during that time frame; however, you can narrow down the output to a particular user by specifying their login name.

πŸ“
You can specify multiple user’s login names by using the space as a separator.
$ pinky david

Output:

Checking a single user using the pinky command

Now, let’s keep this aside and jump to the next section to look at the various options offered by this command.

Pinky Command Options

The pinky command accepts various options based on which you can hide the header, full name, host name, idle time, etc. based on the specified option.

Do Not Print the Header in the Output

The β€œ-f” flag can be specified with or without a username to hide the header from the output.

$ pinky -f

Output:

pinky command output with header

Display Specific User Information in Long Format

By default, the pinky command returns the single specified user output in a single column that can be changed to a long format.

In this format, some extra information related to the specified user will be included, like the user’s home directory and default login shell.

$ pinky -l david

Output:

Print the long-list format output for particular user

Note that when you use the β€œ-l” flag for long format, you must specify at least one username.

Omit the User’s Home Directory and Shell in Long Format

The β€œ-b” flag with the β€œ-l” flag will return the user’s information by excluding the user’s home directory and shell from the output.

$ pinky -lb david

Output:

Do not print the home directory or shell for a specific user

Omit the Users Full Name in the Output

The β€œ-w” flag can be specified with or without username to hide the full (or real) name of the users from the output.

$ pinky -w

Output:

Pinky command output without the user's full name

Omit the Users Full Name and Remote Host in the Output

The β€œ-i” can be specified with or without username to hide the user’s full (or real) name and remote host from the output.

$ pinky -i

Output:

Pinky command output without the user’s full name and hostname

Hide the Users Full Name, Remote Host, and Idle Time in the Output

The β€œ-q” flag can be specified with or without username to remove the user’s full (or real) name, remote host, and idle time from the output.

$ pinky -q

Output:

Pinky command output without users full name, host name and idle time

How to Uninstall/Remove the Pinky from Linux

Execute any of the following commands to remove this program from your system:

$ sudo apt remove pinky                                                                                  #On Debian and Ubuntu
$ sudo dnf remove pinky                                                                                  #On Red Hat and Fedora
$ sudo pacman -R pinky                                                                                   #On Arch and Manjaro

That was the last example of this command.

If you are familiar with the finger command, then you can easily spot that both commands are too similar in terms of naming the options or output.

However, if you have any interesting or advanced tools for sysadmins, then let us know in the comment section.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.