如何在Linux上使用pinky命令

Linux laptop with an Ubuntu-style desktop
Fatmawati Achmad Zaenuri/Shutterstock.com Fatmawati Achmad Zaenuri / Shutterstock.com

Want to find out about the people logged on to your Linux computer? Well, don’t lift a finger; raise your pinky instead.

是否想了解有关登录Linux计算机的人员的信息? 好吧,不要finger ; 反而提高你的pinky

To discover some details about the people logged on to a Linux or Unix-like computer, many system administrators would likely turn to the finger command.  Which is all well and good, but on many systems finger will be absent. It isn’t installed by default. You may well run across a system where this command is unavailable.

为了发现有关登录到Linux或类似Unix的计算机的人员的一些详细信息,许多系统管理员可能会使用finger 命令 。 一切都很好,但是在许多系统上,都将缺少finger 。 默认情况下未安装。 您可能会在无法使用此命令的系统上运行。

Instead of installing finger—assuming you have permission to do so—you can use pinky, a  lightweight and modern version of finger. It was installed by default on all the Linux distributions tested during the research for this article, including Ubuntu, Manjaro, and Fedora.

无需安装finger假设您已获得许可),而可以使用pinky ,这是一种轻巧的现代版本finger. 默认情况下,它已安装在本文研究期间测试过的所有Linux发行版中,包括Ubuntu,Manjaro和Fedora。

精致的触感 (A Delicate Touch)

As you’d expect with a Linux command, pinky has its fair share of command line options (only two of which have names). But surprisingly, they all relate to pruning bits of information out of the reports that pinky produces. You can whittle the output down to include just the information of interest to you.

正如您对Linux命令所期望的那样, pinky具有相当多的命令行选项(其中只有两个具有名称)。 但出乎意料的是,它们都涉及到修剪比特的信息出来 ,报告pinky产生。 您可以减少输出以仅包含您感兴趣的信息。

If pinky starts out as a lightweight, it can be positively featherweight by the time you’ve trimmed off the information you have no interest in.

如果pinky开始时是轻量级的,那么在您修剪掉不感兴趣的信息时,它可能正好可以pinky重量。

使用小指 (Using pinky)

The simplest way to use pinky is to type its name on the command line and hit Enter.

使用pinky的最简单方法是在命令行中键入其名称,然后按Enter。

pinky
pinky in a terminal window

The default output is the “short format” report.

默认输出是“短格式”报告。

output from pinky in a terminal window

The short format report contains the following columns:

简短格式报告包含以下几列:

  • Login: The user name of the person who is logged in.

    登录名:登录人员的用户名。

  • Name: The full name of the person, if known.

    名称:此人的全名(如果知道)。

  • 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 this computer.

    TTY:他们登录的终端类型。 这通常是pts(伪电传)。 :0表示连接到此计算机的物理键盘和屏幕。

  • Idle: Idle time. This shows ????? if the person is running under an X-windows Display Manager, which does not provide that information.

    空闲:空闲时间。 这显示?????? 如果此人在X-windows显示管理器下运行,该管理器不提供该信息。

  • When: The time and date when the person logged in.

    时间:该人登录的时间和日期。

  • Where: The location from which the person is logged in. Often, this will be the IP address of a remote computer. An entry of “:0” means the physical keyboard and screen connected to the Linux computer.

    位置此人登录的位置。通常,这是远程计算机的IP地址。 输入“:0”表示连接到Linux计算机的物理键盘和屏幕。

pinky is sometimes unable to populate a column. It cannot put anything in a column if it doesn’t have that information. For example, the system administrator did not record the full name of the person who owns the user account called “dave.” Obviously, pinky cannot display a full name in the Name column, and uses “dave” instead.

pinky有时无法填充列。 如果没有该信息,则无法在列中放置任何内容。 例如,系统管理员没有记录拥有用户帐户“ dave”的人的全名。 显然, pinky无法在“名称”列中显示全名,而是使用“ dave”。

报告单个用户 (Reporting on a Single User)

By default, pinky reports on every person that is logged in. To report on a single person, pass their user name to pinky on the command line.

默认情况下, pinky报告每个登录的用户。要报告单个人,请在命令行上将其用户名传递给pinky

pinky mary
pinky mary in a terminal window

As expected, pinky only reports on the person with the user name of “mary.”

不出所料, pinky只报告用户名为“玛丽”的人。

Output from pinky in a terminal window

省略列标题 (Omitting Column Headings)

To remove the column headings from the short format report use the -f option.

要从短格式报告中删除列标题,请使用-f选项。

pinky -f
output from pinky with -l and -b options in a terminal window

The column headings are removed from the report.

列标题已从报告中删除。

pinky output wioth no column headings in a terminal window

省略名称列 (Omitting the Name Column)

The -w option causes pinky to omit the “Name” column.

-w选项使pinky省略“名称”列。

pinky -w alec
pinky -w alec in a terminal window

The resulting report has no “Name” column in it.

结果报告中没有“名称”列。

pinky report with no name column in a terminal window

省略名称和位置列 (Omitting the Name and Where Columns)

The -i option cause pinky to omit both the  “Name” and the “Where” columns.

-i选项使pinky省略“名称”和“位置”列。

pinky -i robert
pinky -i robert in a terminal window

The report from pinky no longer contains the “Name” and “Where” columns.

pinky的报告不再包含“名称”和“位置”列。

pinky report without name and where columns in a terminal widnow

省略名称,空闲和位置列 (Omitting the Name, Idle and Where Columns)

To really strip things back, you can use the -q option to omit the “Name,” “Idle,” and “Where” columns.

要真正剥离内容,可以使用-q选项来省略“名称”,“空闲”和“位置”列。

pinky -q john
pinky -q john in a terminal window

pinky obediently removes the “Name,” “Idle,” and “Where” columns from the report. We’re down to three columns now. If we take anything else out, it’ll hardly be a report at all.

pinky乖乖地从报告中删除了“名称”,“空闲”和“位置”列。 现在我们只有三栏。 如果我们采取其他措施,则几乎不会是一份报告。

pinky report without name, idel and where columns in a terminal window

长格式报告 (The Long Format Report)

The -l (long format report) option causes pinky to increase the information provided on the individuals in the report. You must provide the name of a user account on the command line.

-l (长格式报告)选项使pinky 增加报告中有关个人的信息。 您必须在命令行上提供用户帐户的名称。

(This is one of the two command line options to be blessed with a name. The other is the -s (short format report) option. Because the default output is the short format report, the -s option doesn’t actually do anything.)

(这是两个带有名称的命令行选项之一。另一个是-s (短格式报告)选项。因为默认输出是短格式报告,所以-s选项实际上不执行任何操作)

pinky -l mary
pinky -l mary in a terminal window

The long format report contains a few pieces of additional information.

长格式报告包含一些其他信息。

extra information in the pinky report in a terminal window

The information provided in the long format report is:

长格式报告中提供的信息是:

  • Login name: The user name of the person who is logged in.

    登录名:登录人员的用户名。

  • In real life: The full name of the person, if known.

    在现实生活中:人的全名(如果知道)。

  • Directory: This person’s home directory.

    目录:此人的主目录。

  • Shell: The shell this person is using.

    外壳:此人正在使用的外壳。

  • Project: The contents of this person’s ~/.project file, if it exists.

    项目:此人的〜/ .project文件的内容(如果存在)。

  • Plan: The contents of this person’s ~/.plan file, if it exists.

    计划:此人的〜/ .plan文件的内容(如果存在)。

The idea behind the ~/.project file was that it should be used to hold a short description of the project or work item a computer user was engaged on. Likewise, the contents of their ~/.plan file would be a short description of the actual work item for that project. It allowed managers and interested parties to see what work an individual was occupied with, and which project that work belonged to. This scheme is rarely used nowadays. These fields are likely to be blank for the vast majority of people.

〜/ .project文件背后的想法是,应使用它来简短描述计算机用户从事的项目或工作项。 同样,它们的〜/ .plan文件的内容将是对该项目实际工作项目的简短描述。 它使管理人员和感兴趣的方可以查看个人从事的工作以及该工作属于哪个项目。 该方案如今很少使用。 对于绝大多数人来说,这些领域可能是空白的。

Let’s look at Alec:

让我们看一下Alec:

pinky -l alec
pinky -l alec

Alec has neither a ~/.plan file nor a ~./project file.

Alec既没有〜/ .plan文件,也没有〜。/ project文件。

long format output from pinky for user with no plan nor project file in a terminal window

省略目录和命令行 (Omitting the Directory and Shell Line)

To omit the line reporting on the home directory and the shell from the long format report, use the -b option.

要从长格式报告中省略主目录和外壳程序上的行报告,请使用-b选项。

pinky -l -b robert
pinky -l -b robert in a terminal window

The line reporting on the home directory and shell is removed from the report.

主目录和外壳程序上的报告行将从报告中删除。

pinky report with no directory and shell line in a terminal window

省略项目文件 (Omitting the Project File)

To have the project line omitted from the long format report, use the -h option.

要使长格式报告中省略项目行,请使用-h选项。

pinky -l -h mary
pinky -l -p mary in a terminal window

The contents of the ~/.project file are not reported on.

〜/ .project文件的内容未报告。

pinky long format report without the project file in a terminal window

省略计划文件 (Omitting the Plan File)

To have the plan line omitted from the long format report, use the -p option.

要使长格式报告中省略计划行,请使用-p选项。

pinky -l -p mary
pinky -l -p mary in a terminal window

The contents of the ~/.plan file are not reported on.

〜/ .plan文件的内容未报告。

pink report with the plan file omitted in a terminal window

为什么所有省略选项? (Why All the Omit Options?)

Why might a command that generates reports have so many options to remove bits of information? It allows you to focus on the information that you really want. So you have options to separate the wheat from the chaff. And you get to decide which is which.

为什么生成报告的命令有这么多的选项可以删除信息? 它使您可以专注于您真正想要的信息。 因此,您可以选择从谷壳中分离出小麦。 然后您可以决定哪个是哪个。

翻译自: https://www.howtogeek.com/427004/how-to-use-the-pinky-command-on-linux/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值