--help、man和info工具的区别 Linux and Unix 命令手册

http://blog.chinaunix.net/space.php?uid=20393955&do=blog&id=344843

--help、man和info工具的区别   Linux and Unix 命令手册

本命令手册以实用,简洁为原则,对于已经消化的内容,不附加详细的注解。

磁针石

联系方式: QQ:37391319 gmail and gtalk: xurongzhong@gmail.com

参考资料

*http://linux.ccidnet.com/art/305/20071128/1290639_1.html

Linux操作系统为我们提供了十分方便的系统文档帮助信息。例如“--help”选项、man工具和info工具文档等。许多初学者对于这三种帮助信息的概念并不是十分了解,下面就让我们来作一些具有针对性的讲解。

“--help”选项

“--help”是一个工具选项,大部分的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页内容的副本补充。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值