Linux

Linux Pinky Command Tutorial for Beginners (8 Examples)

0
Linux Pinky Command Tutorial for Beginners (8 Examples)

Finger commands on Linux are popular tools for retrieving information related to system users. However, this utility is not installed with all Linux distributions. For example, Ubuntu 20.04 LTS doesn’t come with a finger out of the box. Although you can always download and use the finger command, there are lightweight alternatives pre-installed (at least on Ubuntu).

The device in question is called pinky. In this article, we will discuss the basics of pinky using some easy-to-understand examples. But before we do that, it is worth mentioning that all the examples here have been tested on an Ubuntu 20.04 LTS machine.

Pinky Linux commands

The man page for pinky explains it the same as:

 pinky - lightweight finger

Following is the syntax of the tool:

pinky [OPTION]... [USER]...

And here are some examples of Q&A styles that should give you a better idea of how the pinkie tool works.

Q1 How does pinky work?

The basic usage is simple, just run ‘pinky’ without any argument.

pinky

Here is the output this command generates on my system:

Login    Name                 TTY      Idle   When             Where
himanshu Himanshu            ?:0       ?????  2018-09-04 09:31 :0

So you can see the output containing information such as the user’s login name, real / full name, terminal, login time, and remote host. By default, output is generated for the current user. Of course, you can use Pinky to retrieve information for other users too – in this case, you must specify a username.

pinky USERNAME

Q2 How to make pinky produce long format output?

This can be done using the -l command-line option.

pinky -l

The following output is generated by this command on my system:

Login name: himanshu                    In real life:  Himanshu
Directory: /home/himanshu               Shell:  /bin/bash

Note that the -l option requires that you mention your username – in other words, mentioning a username is mandatory in this case.

Q3 How do you get rid of the home directory and shell info in long format?

This can be achieved by clubbing the -b option with the -l option.

pinky -lb himanshu

Following is the output:

Login name: himanshu                    In real life:  Himanshu

So, you can see that the directory and shell related information is not currently produced around the output. Similarly, you can use the -h and -p options to delete user project files and plan file information (if available), respectively, in long format.

Q4 How to make pinky delete column headings?

This can be done using the -f command-line option.

For example, this command:

pinky -f himanshu

produces the following output on my system:

himanshu Himanshu            ?:0       ?????  2018-09-04 09:31 :0

So as you can see, the column headers have been removed in the output.

Q5 How to make pinky eliminate the full name of the user in the output?

This can be done using the -w command-line option.

For example, this:

pinky -w himanshu

produces the following output:

Login     TTY      Idle   When             Where
himanshu ?:0       ?????  2018-09-04 09:31 :0

So you can see the column entries for the full name removed from the output. There are two other options that do the same:

-i omit the user's full name and remote host in short format

-q omit  the  user's  full name, remote host and idle time in short format

Conclusion

As you might agree, pinky is a small tool that is useful for those who work with user system information. In this article, we have covered most of the tool options. After you finish practicing this, go to the Pinky man page to learn more about the commands.

How to Add, Use and Customize Widgets on your iPhone

Previous article

How to Install Ruby on Rails (RoR) on Debian 10

Next article

You may also like

More in Linux