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

相关推荐

  • 系统启动和内核管理-1

    1、Linux 组成 kernel: 进程管理、内存管理、网络管理、驱动程序、文件系统、安全功能等等 rootfs: 程序和glibc 内核设计流派: 单内核(monolithic kernel)-Linux-把所有功能集成于同一个程序 微内核(micro kernel)-Windows, Solaris-每种功能使用一个单独子系统实现 1)、Linux内核…

    Linux干货 2016-09-13
  • 网络通信安全基础OpenSSL

    OpenSSL: NIST: 保密性: 数据保密性 隐私性 完整性: 数据完整性 系统完整性 可用性  安全攻击: 被动攻击:窃听 主动攻击:伪装、重放、消息篡改、拒绝服  安全机制: 加密、数字签名、访问控制、数据完整性、认证交换、流量填充、路由控制、公证 安全服务: 认证 访问控制 数据保密性 连接保密性 无连接保密性 选择域保密性 …

    Linux干货 2015-09-06
  • 推荐-LVS专题: LVS+Keepalived并使用DNS轮询实现Director的高可用和负载均衡

    LVS专题: LVS+Keepalived并使用DNS轮询实现Director的高可用和负载均衡 前言 什么是KeepAlived 实验介绍 实验拓扑 实验环境 实验步骤 配置KeepAlived(1) 实现Director 的VIP互为主从 测试 配置LVS 配置KeepAlived(2) 测试LVS 配置RS的IP和web服务 配置DNS 最终测试 总结…

    Linux干货 2016-04-09
  • BASH编程基础之变量、条件判断

    一、前言 在linux中,通常我们所指的脚本编程,指的是bash的脚本编程。 bash作为一种过程式的编程语言来说,它应该具备编程语言所应该具备的基本元素,即:变量,流程,函数,数组。今天我们介绍变量以及流程之一的条件判断。 二、变量 1、初识变量 在编程语言中,编程语言有两大种,强类型语言和弱类型语言。强类型语言中,要求变量的使用要严格符合定义,所有变量都…

    Linux干货 2015-07-06
  • shell四剑客之find

    find命令详解 ### 命令格式 find pathname -options [-print -exec -ok] ### 命令参数 pathname:find命令所查找的目录路径。例如用.表示当前目录,用/来表示系统根目录 -print:find命令将会匹配的文件输出到标准输出。-e…

    Linux干货 2016-08-22
  • N22-love cat 17周博客作业第2部分-构建一个LVS-DR模型的高性能集群

    题目: 搭建一个LVS-DR模型的高性能集群,并实现以下功能:       (1)、wordpress程序通过nfs共享给个个realserver;       (2)、后端realserver中的nginx和php分离; 第17周   第2部分 网…

    Linux干货 2016-08-15