linux finger_如何在Linux上使用finger命令

linux finger

linux finger

A terminal window on an Ubuntu-style Linux desktop
Fatmawati Achmad Zaenuri/Shutterstock.com 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.

了解谁在使用您的Linux或类Unix系统是管理它的基本部分。 指着某人可能被认为是不礼貌的,但是用finger仍然可以启发人。

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.

几乎可以肯定,Linux发行版中默认没有安装finger命令。 用于研究本文的Ubuntu,Fedora和Manjaro发行版中没有该版本。 我们已经介绍pinky命令 ,它是finger的轻量级版本。 默认情况下提供pinky ,但如果要使用fingerYou ,请安装它。

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.

fingerpinky命令执行相同类型的任务。 它们都告诉您有关 Linux或类似Unix操作系统上当前登录用户的一些信息。 他们各自提供的信息集略有不同,并且pinky还提供了一些其他选项来逐渐修剪掉您可能不想看到的位。

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.

如果您希望Linux设置得更像“类Unix”而不是“类Linux”,则可以使用finger 。 也许您已经继承了一些期望finger可用的脚本。 但是,无论您是出于何种原因而被迫(或更喜欢使用) finger ,这里都是如何安装和使用它的方法。

安装手指 (Installing finger)

You can install finger on Ubuntu with this command:

您可以使用以下命令在Ubuntu上安装finger

sudo apt-get install finger
sudo apt-get install finger in a terminal window

To install finger on Fedora, use this command:

要将finger安装在Fedora上,请使用以下命令:

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.

在Manjaro上,您需要从Arch用户存储库 (AUR)安装finger ,并从其源代码进行构建。 有一些工具可以帮助您完成此任务,因此这是一个自动化的过程。 很好,但这确实意味着您必须在Manjaro系统上安装那些工具,以及从AUR检索和安装finger的工具。 因此,我们需要先安装这些。

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

如果您的系统上没有合适的AUR安装程序, trizen是不错的选择。 此命令将安装它。

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.

在使用trizen为我们安装finger之前,我们需要安装一些开发工具。 这些将由trizen将调用以在系统上安装finger的安装和构建脚本自动调用。 当然,如果您以前从AUR安装了项目,或者进行了任何软件开发,则可能已经安装了这些项目。

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

我们需要安装GNU C库 。 我们使用以下命令执行此操作:

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:

我们还需要GNU Binutils 。 这些由gcc编译器使用:

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:

make实用程序用于从其源代码控制实际的finger 编译和构建 。 使用以下命令安装它:

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:

当然,如果没有编译器,我们将无法从源代码构建某些东西。 我们肯定需要gcc ,即GNU编译器集合 。 此命令将为您安装:

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 ,我们可以发出命令来实际安装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.

随着安装的进行,将向您提出各种问题。 只需按“ Enter”接受默认值。

用手指 (Using finger)

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

键入finger并单击“ Enter”会使finger生成其默认输出。

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.

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

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

    空闲 :用户的空闲时间。 如果是个位数,则表示分钟。 如果存在冒号,则表示小时和分钟,如果存在“ d”,则表示天和小时。

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

    办公室 :这是一个历史遗留。 它用于显示此人工作的房间的名称或编号。 如今,这种情况很少是由root建立的。 相反, finger将显示用户登录的计算机的IP地址。 “:0”表示连接到计算机的物理键盘和屏幕。

  • Office Phone: This is another legacy item. If root hasn’t recorded the office phone number for a person, it will show a blank.

    办公电话 :这是另一个旧项目。 如果root尚未记录某人的办公室电话号码,它将显示为空白。

与一个用户一起使用手指 (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.

    因为 :用户登录的时间和日期,以及哪个tty和哪个IP地址。

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

    邮件 :如果他们有邮件,则会显示。 如果他们最近检查过邮件,则会显示他们检查邮件的时间。 Alec没有等待他的邮件。

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

    计划 :如果用户在其主目录中创建了一个“ .plan”和“ .project”文件,并在其中放置了一些文字以描述其工作内容,则这些文件的内容将显示在此处。 这是当今很少使用的系统。 有人告诉我们Alec没有计划。 那不是对他的职业战略的指责,这意味着他没有费心更新他的“ .plan”文件。

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.

如果我们重复此命令,请看一下Mary,我们将看到她很勤奋,并在她的“ .plan”和“ .project”文件中添加了一些描述性文字。

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使用一个人的真实姓名。 如果您不记得他们的帐户名,请使用他们的真实姓名。

finger alec tumovit
finger alec tumovit in a terminal window

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

作为奖励,您可以找出他们的帐户名称。

省略.plan和.project文件 (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.

如果您不想看到“ .plan”和“ .project”文件摘要,请使用-p (无计划)选项。

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.

尽管Mary具有有效的“ .plan”和“ .project”文件,但是finger忽略了它们,并且不报告其内容。

使用长列表选项 (Using the Long Listing Option)

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

要以长格式显示查看所有用户的列表,请使用-l (长格式)选项。

finger -l
finger -l in a terminal window

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

这使finger以长显示格式列出所有已登录的用户。

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.

通常,Linux为您提供选择。 您可以使用pinky ,也可以使用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.

它们之间的真正区别在于, pinky具有额外的技巧,可以使您非常细致地删除不感兴趣的数据。 当然,它是预安装的。

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

linux finger

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值