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)
AleenAleen
上一篇 2016-08-02
下一篇 2016-08-02

相关推荐

  • 文件查找命令find

      在文件系统上常常需要根据文件的各种属性去查找符合条件的文件。在Linux下也有相当优异的查找命令。今天只要将find和locate。find通常不常用,因为速度慢!通常我们先使用locate来进行模糊查找,如果真找不到了,才以find来查找。为什么呢?因为locate是利用数据库来查找数据,所以速度非常快,而且并没有实际查询硬盘比较省时间。 l…

    Linux干货 2016-08-22
  • 证书及加解密原理图解

    证书管理 现在上网大多数网站都是使用https的协议,https是一个安全的访问方式,数据在传输过程中是加密的,这时候在服务器端就需要使用证书。 科普加解密流程 服务器端客户端 服务器在和客户端通信前必须先建立SSL会话,下图解析SSL会话过程

    Linux干货 2016-09-25
  • selinux介绍

    本章内容 SELinux概念启用SELinux管理文件安全标签管理端口标签管理SELinux布尔值开关管理日志查看SELinux帮助 SELinux介绍 SELinux: Secure Enhanced Linux,是美国国家安全局「NSA=The National Security Agency」和SCC(Secure Computing Corporat…

    Linux干货 2016-09-19
  • 基于Keepalived+Nginx实现高可用负载均衡

    练习贴,测试keepalived+lvs_dr高可用负载均衡

    2017-12-11
  • 第三周作业

    1、列出当前系统上所有已登录的用户的用户名,注意:同一个用户登录多次,则只显示一次即可。 ~]# who | cut -d ' ' -f 1 | sort -u 2、取出最后登录到当前系统的用户的相关信息。 ~]# la…

    Linux干货 2016-12-19
  • 马哥教育网络班19期第十二周课程练习

    1、请描述一次完整的http请求处理过程; 一次完整的http请求处理过程如下: (1) 建立或处理连接:接收客户端的请求,建立连接,或是拒绝其请求 (2) 接收请求: 接收来自于网络的请求报文中对某资源的一次请求的过程时,web服务器也分几种模型对并发请求进行响应:             &nb…

    Linux干货 2016-08-11