M20 – 1- 第二周博客(1):帮助手册查询的使用

Linux系统中存在诸多的命令,而这些命令分为内键命令和外部命令。如何查询命令属于内部还是外部呢。前一篇博客已经介绍type命令,type命令可以区分命令属于内部还是外部,下面举个例子:

blob.png

为什么这一期博客还重复讲如何区分内部与外部命令呢,因为在man手册查询中,内部命令并不是使用man查询帮助手册,仅仅使用与外部命令,那内键命令如何查询呢,接下来要讲的就是help命令,help命令是用于查询内键命令的。

Linux命令的帮助查询以及获取

1、内键命令帮助手册查询

help命令

简介:
Display information about builtin commands.
格式:
help [-dms] [pattern ...]
实例1:
[root@centos6 ~]# help cd  #cd为内键命令,因此用help命令查询,可获取cd的帮助手册
cd: cd [-L|-P] [dir]
    Change the shell working directory.
    
    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable.
    
    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.
    
    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.
    
    Options:
        -L	force symbolic links to be followed
        -P	use the physical directory structure without following symbolic
    	links
    
    The default is to follow symbolic links, as if `-L' were specified.
    
    Exit Status:
    Returns 0 if the directory is changed; non-zero otherwise.

2、外部命令帮助手册查询

man命令

简介:
man - an interface to the on-line reference manuals
格式:
man COMMAND
实例1:
[root@centos6 ~]# type ifconfig
ifconfig is /sbin/ifconfig
[root@centos6 ~]# man ifconfig




IFCONFIG(8)                Linux Programmer’s Manual               IFCONFIG(8)

NAME
       ifconfig - configure a network interface

SYNOPSIS
       ifconfig [interface]
       ifconfig interface [aftype] options | address ...

NOTE
       This program is obsolete!  For replacement check ip addr and ip link.  For statistics use ip -s link.

3、man帮助手册中的段落说明

3.1、man手册页

man手册页包含:man1..man8,、
分别讲的是(1)man1: 用户命令、man2: 系统调用、man3: C库调用、man4: 设备文件及特殊文件、man5: 配置文件格式、man6: 游戏、man7: 杂项、man8: 管理类的命令

blob.png

3.2、man命令的配置文件

man命令的配置文件:/etc/man.config
平常在安装某些程序的时候,程序自身也自带man手册,安装完程序后,不但要对该程序的自身命令做环境变量,也要对做的环境变量设置man手册,如何配置该程序的命令man手册呢,直接在
man的配置文件中添加该程序的man路径即可。如下图:

blob.png

3.3、帮助手册中的段落说明

NAME          //名称
SYNOPSIS        //简介
DESCRIPTION      //描述
OPTIONS        //选项
EXAMPLES        //实例
AUTHOR         //作者
REPORTING BUGS    //错误报告
SEE ALSO        //参见
而SYNOPSIS中可分为
[]:可选的内容
<>: 必选的内容
a|b:二选一
...: 同一内容可出现多次

3.4、man命令查询的操作方法

(1)翻页查询:

Space, ^V, ^f, ^F:  向文件尾翻屏;
b, ^B:  向文件首部翻屏;
d, ^D:  向文件尾部翻半屏;
u, ^U:  向文件首部翻半屏;
RETURN, ^N, e, ^E or j or ^J:  向文件尾部翻一行;
y or ^Y or ^P or k or ^K: 向文件首部翻一行;
q:  退出;

(2)跳转查询:

1G:  回到文件首部
G:  翻至文件尾部

(3)文本搜索:

KEYWORD: 
以KEYWORD指定的字符串为关键字,从当前位置向文件尾部搜索;不区分字符大小写;
n: 下一个
N:上一个
				
?KEYWORD:
以KEYWORD指定的字符串为关键字,从当前位置向文件首部搜索;不区分字符大小写;
n: 跟搜索命令同方向,下一个
N:跟搜索命令反方向,上一个

4、info命令

简介:
 info - read Info documents
格式:
info [OPTION]... [MENU-ITEM...]
[root@centos6 ~]# type info   #info命令属于外部命令
info is /usr/bin/info
[root@centos6 ~]# info ifconfig   #info命令也可以查询外部命令的帮助手册,且比man命令的详解更简洁

File: *manpages*,  Node: ifconfig,  Up: (dir)

IFCONFIG(8)                Linux Programmer’s Manual               IFCONFIG(8)



NAME
       ifconfig - configure a network interface


SYNOPSIS
       ifconfig [interface]
       ifconfig interface [aftype] options | address ...


NOTE
       This  program  is obsolete!  For replacement check ip addr and ip link.
       For statistics use ip -s link.


DESCRIPTION
       Ifconfig is used to configure the kernel-resident  network  interfaces.
       It is used at boot time to set up interfaces as necessary.  After that,
       it is usually only needed when  debugging  or  when  system  tuning  is
       needed.

info命令查询的操作方法

方向键: PgUp,PgDn 导航
Tab键: 移动到下一个链接
d: 显示主题目录
Home: 显示主题首部
Enter: 进入选定链接
n/p/u/l: 进入下/前/上一层/最后一个链接
s: 文字文本搜索
q: 退出info

5、利用网络资源查询命令的使用

(1)http://www.redhat.com/docs
(2)http://os.51cto.com/linuxman/
(3)seo搜索引擎查询,Google、baidu

原创文章,作者:Aleen,如若转载,请注明出处:http://www.178linux.com/26852

(0)
上一篇 2016-08-02 16:50
下一篇 2016-08-02 19:14

相关推荐

  • 第五周作业

    博客具体内容请移步博客园http://www.cnblogs.com/wangenzhi/p/6235456.html

    Linux干货 2016-12-30
  • NFS,samba,vsftpd的基本使用

    一.NFS介绍 NFS(Network File System),全名叫做网络文件系统,是由SUN公司研发的。顾名思义,简单理解就是通过网络互联,将本地的文件系统共享出去,从而实现资源的共享,NFS监听在TCP的2049端口上。当涉及到主机之间的通信时,就会存在安全问题,于是为了安全考虑,主动提出请求的一方(客户端)需要提供一些基本信息来认证,这些信息是需要…

    Linux干货 2017-01-04
  • DNS服务器之配置

    一、安装DNS服务器     DNS服务的安装包为bind,使用yum直接安装即可:     安装完成后,查看DNS服务相关的文件: 二、配置正向区域     1、在配置正向区域之前,先来看下主配置文件中的内容:    &nbsp…

    Linux干货 2015-05-03
  • N25-第五周博客作业

    1、显示/boot/grub/grub.conf中以至少一个空白字符开头的行; [root@localhost ~]# grep "^[[:space:]]\+" /boot/grub/grub.conf      root (hd0,0)…

    Linux干货 2017-01-06
  • 广域网中的DNS服务

    拓扑图                      创建主DNS:     配置文件/etc/named.conf&nbs…

    2017-04-15
  • grep的用法

    grep的用法 1、复制/etc/skel目录为/home/tuser1及其内容文件的属组和其它用户均没有任何访问权限。 cp -R /etc/skel /home/thuser1 #复制文件/etc/skel 到/home/目录下并改名为thuser1 chmod -R 700 /home/thuser1 #更改/home/thuser1目录权限为属主全部…

    Linux干货 2017-07-23