Linux pinky Command Tutorial for Beginners (8 Examples)
The finger command in Linux is a popular tool to fetch information related to system users. However, this utility doesn’t come pre-installed with all Linux distributions. For example, Ubuntu 18.04 LTS doesn’t come with it out of the box. While you can always download and use the finger command, there’s a lightweight alternative that comes pre-installed (at least on Ubuntu).
The tool 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’s worth mentioning that all examples here have been tested on an Ubuntu 18.04 LTS machine.
Linux pinky command
The man page for pinky explains it just as:
pinky - lightweight finger
Here’s is the tool’s syntax:
pinky [OPTION]… [USER]…
And following are some Q&A-styled examples that should give you an even better idea on how the pinky tool works.
Q1. How pinky works?
Basic usage is simple, just execute ‘pinky’ sans any argument.
pinky
Here’s the output this command produced on my system:
Login Name TTY Idle When Where
himanshu Himanshu ?:0 ????? 2018-09-04 09:31 :0
So you can see the output contains information like the user’s login name, real/full name, terminal, login time, and remote host. By default, the output produced is for the current user. Of course, you can use pinky to fetch information for other users as well – in that case, you’ll have specify the user name.
pinky USERNAME
Q2. How to make pinky produce long format output?
This can be done using the -l command line option.
pinky -l
Following output was produced 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 you to mention the user name – in other words, mentioning username is mandatory in this case.
Q3. How to omit 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 wasn’t produced in output this time around. Similarly you can use the -h and -p options to remove the user’s project file and plan file information (if available), respectively, in the long format.
Q4. How to make pinky remove column headings?
This can be done using the -f command line option.
For example, this command:
pinky -f himanshu
produced the following output on my system:
himanshu Himanshu ?:0 ????? 2018-09-04 09:31 :0
So as you can see, the column headers were removed in the output.
Q5. How to make pinky omit user’s full name in output?
This can be done using the -w command line option.
For example, this:
pinky -w himanshu
produced the following output:
Login TTY Idle When Where
himanshu ?:0 ????? 2018-09-04 09:31 :0
So you can see the column entry for full name was omitted from output. There are two other options that do similar stuff:
-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’d likely agree, pinky is a handy little tool for those who work with system users’ information. In this article, we have discussed majority of the tool’s options. Once you are done practicing these, head to pinky’s man page to learn more about the command.