您的位置:首页 > 运维架构 > Linux

Linux下如何获取帮助?

2014-10-12 15:35 225 查看
Linux下如何获取帮助

Linux下要获取命令的使用帮助,可有以下几种方法:
一、通过help命令
二、man命令查询手册(manual)
三、info命令获取在下文档帮助
四、通过google搜索引擎获取帮助
五、在Linux的/usr/share/doc路径下,绝大多数程序都有相应的帮助手册。

==================
一、通过help命令
1、使用help命令获取帮助,需要用type命令区分是内部命令和外部命令,格式为:
type COMMAND
(1)内部命令:包含在shell中,是shell的一部分,由shell识别并允许在shell内部的命令,系统加载运行时就被加载到内存中的命令。内部命令获取帮助的格式:
help COMMAND
(2)外部命令:是实用程序部分,通常功能比较强大,包含的程序量也很大,系统加载运行时不被加载,只有需要时才将其调入内存。外部命令获取帮助的格式:
COMMAND --help


二、man命令查询手册(manual)
1、 使用man命令获取帮助,其格式为:
man COMMAND
2、以获取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 -cftuvSUX nor --sort.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
do not ignore entries starting with .
……
3、 man文档类型分为八个章节解析的,通过输入man man 命令获取的信息如下:
The standard sections of the manual include:

1      User Commands    #用户命令,一般在/bin,/usr/bin,/usr/local/bin 路径下

2      System Calls

3      C Library Functions

4      Devices and Special Files  #特殊文件 (设备文件)

5      File Formats and Conventions  #文件格式(配置文件的语法)

6      Games et. Al.

7      Miscellanea

8      System Administration tools and Deamons  #管理命令,一般在/sbin,/usr/sbin,/usr/local/sbin 路径下

Distributions  customize  the  manual section to their specifics, which often include additional sections.

4、通过man COMMAND 中的节目说明:
NAME :命令名称及功能简要说明。
SYNOPSIS:命令的用法说明,包括可用的选项。
DESCRIPTION:命令选项的详尽说明,可能包括每一个选项的意义。
OPTIONS:s说明每一个选项的意义。
FILES:此命令相关的配置文件。
BUGS:此命令存在的不足。
EXAMPLES:使用的示例。
SEE ALSO:另见参照。

5.man命令使用技巧:
(1)使用whatis命令查看自己需要命令的那种含义
[root@TLin ~]# whatis man
man                  (1)  - format and display the on-line manual pages
man                  (1p)  - display system documentation
man                  (7)  - macros to format man pages
man.config [man]     (5)  - configuration data for man
man [manpath]        (1)  - format and display the on-line manual pages
man-pages            (7)  - conventions for writing Linux man pages
然后使用man [章节数] COMMAND进行查询帮助,如下:
man 5 man   #查看配置文件中的相关语法

(2)翻屏
SPACE:向后翻一屏
b: 向前翻一屏
ENTER:向下翻一行
k: 向上翻一行
(3)查找
/keyword :向后查找关键字keywrod
?keyword :向前查找关键字keywrod
n :查找下一个键字keywrod
N :查找上一个键字keywrod
(4)退出 使用q退出命令查询

三、info命令获取在下文档帮助
info命令获取帮助的格式: info COMMAND #info命令说明COMMAND命令的相关历史,信息量比man命令获取的大得多。
通过/keyword的方式进行查询关键字

四、通过google搜索引擎获取帮助

五、在Linux的/usr/share/doc路径下,绝大多数程序都有相应的帮助手册。

本文出自 “奋斗不止” 博客,请务必保留此出处http://peenboo.blog.51cto.com/2865551/1562894
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: