初学者的 Linux 手指命令教程(5 个示例)
在此页
- Linux 手指命令
- Q1。如何使用手指命令?
- Q2。如何使手指显示输出列明智?
- Q3。如何使手指限制输出中的某些信息?
- Q4。如何防止用户实名匹配?
- Q5。关于手指还有哪些值得了解的地方?
- 结论
如果您是 Linux 系统管理员,或者您的工作涉及管理用户,那么您应该了解许多工具。一旦这样的命令行实用程序是 finger,我们将在本教程中讨论其基础知识。但在我们开始之前,值得一提的是,这里的所有示例都已经在 Ubuntu 18.04 LTS 机器上进行了测试。
Linux手指命令
Linux 中的 finger 命令基本上是一个用户信息查找程序。以下是它的语法:
finger [-lmsp] [user ...] [ ...]
以下是工具手册页对其的解释:
The finger displays information about the system users.
以下是一些 Q&A 风格的示例,它们可以让您更好地了解 finger 命令的工作原理。
Q1。如何使用手指命令?
基本用法很简单,只需将用户名作为输入执行 finger。这是一个例子:
finger himanshu
这是在我的系统上生成的上述命令的输出:
Login: himanshu Name: Himanshu
Directory: /home/himanshu Shell: /bin/bash
On since Sat Nov 24 10:16 (IST) on :0 from :0 (messages off)
No mail.
No Plan.
Q2。如何使手指显示输出列明智?
这可以使用 -s 命令行选项来完成。这是一个例子:
finger -s himanshu
这是产生的输出:
Login Name Tty Idle Login Time Office Office Phone
himanshu Himanshu *:0 Nov 24 10:16 (:0)
Q3.如何使手指限制输出中的某些信息?
有一个命令行选项 -p 强制 finger 不显示“.plan”、“.project”和“.pgpkey”文件的内容。这是一个例子:
finger -p himanshu
这是输出:
Login: himanshu Name: Himanshu
Directory: /home/himanshu Shell: /bin/bash
On since Sat Nov 24 10:16 (IST) on :0 from :0 (messages off)
No mail.
所以你可以看到与计划相关的信息没有显示在输出中。
Q4.如何防止用户实名匹配?
默认情况下,您提供的输入用户名与用户登录名和真实姓名相匹配。但如果您愿意,可以使用 -m 命令行选项禁用后者匹配。
finger -m himanshu
Q5.关于手指还有哪些值得了解的地方?
以下是工具手册页的相关摘录:
If no options are specified, finger defaults to the -l style output if operands are provided,
otherwise to the -s style. Note that some fields may be missing, in either format, if information
is not available for them.
If no arguments are specified, finger will print an entry for each user currently logged into the
system.
Finger may be used to look up users on a remote machine. The format is to specify a user as
“”, or “@host”, where the default output format for the former is the -l style, and the
default output format for the latter is the -s style. The -l option is the only option that may
be passed to a remote machine.
If standard output is a socket, finger will emit a carriage return (^M) before every linefeed (^J).
This is for processing remote finger requests when invoked by fingerd(8).
结论
根据您在 Linux 机器上执行的工作类型,finger 命令可能对您有很大帮助。前往工具 Pinky 命令。