如果我不知道命令的名称,如何找到命令?

Zai*_*aid 4 command-line reference

作为 Unix 初学者,我经常发现自己想知道实现我所追求的特定功能的命令的名称。给出命令的作用描述后,我如何才能找出命令的名称?

Chr*_*ian 11

如果您不知道确切的命令名称,一个好的起点是apropos. 您可以在此处或使用找到简短说明man apropos


小智 6

除了apropos(也可以写成man -k),一个有用的命令是man -K key_word(capital K)。这将在手册页中的任何位置搜索带有“key_word”的手册页(man -k仅在简短说明部分中搜索)。无论哪种方式,结果都显示为括号之间的部分:

[gojan@Gonux ~]$ man -K copy
...
cp (1)               - copy files and directories
cp (1p)              - copy files
...
Run Code Online (Sandbox Code Playgroud)

您可以使用此数字来避免歧义,例如:

[gojan@Gonux ~]$ man 1 cp
CP(1)                                                         User Commands                                                         CP(1)

NAME
       cp - copy files and directories
...
[gojan@Gonux ~]$ man 1p cp
CP(1P)                                                  POSIX Programmer's Manual                                                  CP(1P)

PROLOG
       This  manual  page  is  part of the POSIX Programmer's Manual.  The Linux implementation of this interface may differ (consult the
       corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.
Run Code Online (Sandbox Code Playgroud)