加入收藏 | 设为首页 | 会员中心 | 我要投稿 百客网 - 百科网 (https://www.baikewang.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Unix > 正文

例如“--help”选项、man工具和info工具文档等。如

发布时间:2022-11-08 10:47:02 所属栏目:Unix 来源:
导读:  参考资料

  *

  Linux操作系统为我们提供了十分方便的系统文档帮助信息。例如“--help”选项、man工具和info工具文档等。许多初学者对于这三种帮助信息的概念并不是十分了解,下面就让我
  参考资料
 
  *
 
  Linux操作系统为我们提供了十分方便的系统文档帮助信息。例如“--help”选项、man工具和info工具文档等。许多初学者对于这三种帮助信息的概念并不是十分了解,下面就让我们来作一些具有针对性的讲解。
 
  “--help”选项
 
  “--help”是一个工具选项unix命令框,大部分的GNU工具都具备这个选项,“--help”选项可以用来显示一些工具的信息,如在命令行中键入:
 
  ls --help
 
  则会显示如下的信息:
 
  [root@DB-GATE-16 ~]# ls --help
 
  Usage: ls [OPTION]... [FILE]...
 
  List information about the FILEs (the current directory by default).
 
  Sort entries alphabetically if none of -cftuSUX nor --sort.
 
  Mandatory arguments to long options are mandatory for short options too.
 
  -a, --all do not hide entries starting with .
 
  -A, --almost-all do not list implied . and ..
 
  --author print the author of each file
 
  -b, --escape print octal escapes for nongraphic characters
 
  --block-size=SIZE use SIZE-byte blocks
 
  -B, --ignore-backups do not list implied entries ending with ~
 
  -c with -lt: sort by, and show, ctime (time of last
 
  modification of file status information)
 
  with -l: show ctime and sort by name
 
  otherwise: sort by ctime
 
  “man”工具
 
  Man工具可以显示系统手册页中的内容,这些内容大多数都是对命令的解释信息。通过查看系统文档中的man页可以得到程序的更多相关主题信息和Linux的更多特性。man是非常实用的一种工具,当你在使用到某一个并不熟悉的命令时,man命令会显得非常有用。
 
  当需要了解某个工具更为详细的信息时,可以使用命令man后跟工具名的方法来实现。
 
  如在命令行中键入:
 
  $ man ls
 
  则会显示如下的信息:
 
  # man ls
 
  LS(1) User Commands LS(1)
 
  NAME
 
  ls - list directory contents
 
  SYNOPSIS
 
  ls [OPTION]... [FILE]...
 
  DESCRIPTION
 
  List information about the FILEs (the current directory by default). Sort entries alphabetically if none of
 
  -cftuSUX nor --sort.
 
  Mandatory arguments to long options are mandatory for short options too.
 
  -a, --all
 
  do not hide entries starting with .
 
  -A, --almost-all
 
  do not list implied . and ..
 
  --author
 
  print the author of each file
 
  -b, --escape
 
  print octal escapes for nongraphic characters
 
  --block-size=SIZE
 
  use SIZE-byte blocks
 
  按下space键可以显示下一屏的文本信息;按下q键则会退出man并返回到shell的提示符下。也可以利用pageup和pagedown来进行滚动浏览。
 
  “info”显示工具信息
 
  Info工具是一个基于菜单的超文本系统,由GNU项目开发并由Linux发布。info工具包括一些关于Linux shell、工具、GNU项目开发程序的说明文档。
 
  如在命令行中键入:
 
  # info ls
 
  File: coreutils.info, Node: ls invocation, Next: dir invocation, Up: Directory listing
 
  10.1 `ls': List directory contents
 
  ==================================
 
  The `ls' program lists information about files (of any type, including
 
  directories). Options and file arguments can be intermixed
 
  arbitrarily, as usual.
 
  For non-option command-line arguments that are directories, by
 
  default `ls' lists the contents of directories, not recursively, and
 
  omitting files with names beginning with `.'. For other non-option
 
  arguments, by default `ls' lists just the file name. If no non-option
 
  argument is specified, `ls' operates on the current directory, acting
 
  as if it had been invoked with a single argument of `.'.
 
  By default, the output is sorted alphabetically, according to the
 
  locale settings in effect. (1) If standard output is a terminal, the
 
  output is in columns (sorted vertically) and control characters are
 
  output as question marks; otherwise, the output is listed one per line
 
  and control characters are output as-is.
 
  则会显示如下的信息:
 
  (以上的信息来自可编辑文件,不同的linux版本显示的结果可能会不同。)
 
  当出现以上的信息内容后:
 
  按下?键,可以列出info窗口中的相关命令。
 
  按下SPACE键,可以在菜单项中进行滚动浏览。
 
  三者的比较:
 
  “--help”选项并不是一个“独立”的工具。作为一种命令的选项,它可以用来修改工具或者命令的工作方式。命令的选项通常由一个或两个连字符后跟一个或多个字母来指定。选项出现在所调用的工具名后,用空格隔开。工具的其它参数都跟在选项后,也用空格隔开。“--help”选项就像分页程序“| less”一样,它所提供的是一种快捷、高效的帮助。
 
  Man和info就像两个集合,它们有一个交集部分,但与man相比,info工具可显示更完整的最新的GNU工具信息。若man页包含的某个工具的概要信息在info中也有介绍,那么man页中会有“请参考info页更详细内容”的字样。通常情况下,man工具显示的非GNU工具的信息是唯一的,而info工具显示的非GNU工具的信息是man页内容的副本补充。
 

(编辑:百客网 - 百科网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章