Linux学习笔记-帮助类命令

1.9.1.man

英文:manual

获得命令或者配置文件的帮助信息

 

查看ls命令的帮助信息

man ls

 

类似于moreless合在一起的命令使用方式

 

空格:翻页

q:退出

回车:一行一行向下翻

输入/ 和搜索内容,按回车可以搜索

 

 

查看配置文件帮助时,不能使用绝对路径,直接输入配置文件名称就可以了。

 

查看配置文件yum.conf的帮助信息

man yum.conf

 

查看passwd配置文件的帮助

[root@localhost ~]# which passwd

/usr/bin/passwd

[root@localhost ~]# whereis passwd

passwd: /usr/bin/passwd /etc/passwd /usr/share/man/man1/passwd.1.gz

 

whereis 显示了passwd是一个命令,同时还一个同名的配置文件,此时使用man passwd显示的是命令的帮助,而不是配置文件的帮助。

passwd.1.gz代表的是命令的帮助,1表示命令帮助,5表示配置文件的帮助,例如:passwd.5.gz

 

此时要查看配置文件帮助怎么办?如下命令

man 5 passwd

1.9.2.whatis

whatis 查看一个命令的简述,是干什么的。

[root@localhost ~]# whatis ls

ls (1)               - list directory contents

1.9.3.apropos

查看配置文件的简述,是做什么的

[root@localhost ~]# apropos yum.conf

yum.conf (5)         - Configuration file for yum(8).

1.9.4.–help

命令 –help

所有的命令几乎都有这个选项

 

[root@localhost ~]# whatis --help

Usage: whatis [OPTION...] KEYWORD...

 

  -d, --debug                emit debugging messages

  -v, --verbose              print verbose warning messages

  -r, --regex                interpret each keyword as a regex

  -w, --wildcard             the keyword(s) contain wildcards

  -l, --long                 do not trim output to terminal width

  -C, --config-file=FILE     use this user configuration file

  -L, --locale=LOCALE        define the locale for this search

  -m, --systems=SYSTEM       use manual pages from other systems

  -M, --manpath=PATH         set search path for manual pages to PATH

  -s, --sections=LIST, --section=LIST

                             search only these sections (colon-separated)

  -?, --help                 give this help list

      --usage                give a short usage message

  -V, --version              print program version

 

Mandatory or optional arguments to long options are also mandatory or optional

for any corresponding short options.

 

Report bugs to [email protected].

[root@localhost ~]#

1.9.5.info

也是帮助信息,和man差不多,只是方式不一样。

1.9.6.help

怎么判断是不是内置命令?

man cd

 

BASH_BUILTINS(1)                            General Commands Manual                            BASH_BUILTINS(1)

 

NAME

       bash,  :,  .,  [, alias, bg, bind, break, builtin, caller, cd, command, compgen, complete, compopt, con

       tinue, declare, dirs, disown, echo, enable, eval, exec, exit, export,  false,  fc,  fg,  getopts,  hash,

       help,  history,  jobs,  kill,  let,  local,  logout,  mapfile, popd, printf, pushd, pwd, read, readonly,

       return, set, shift, shopt, source, suspend, test, times, trap, true, type, typeset, ulimit, umask,  una

       lias, unset, wait - bash built-in commands, see bash(1)

 

 

查看umask内置命令的帮助信息

[root@localhost ~]# help umask

umask: umask [-p] [-S] [mode]

    Display or set file mode mask.

 

    Sets the user file-creation mask to MODE.  If MODE is omitted, prints

    the current value of the mask.

 

    If MODE begins with a digit, it is interpreted as an octal number;

    otherwise it is a symbolic mode string like that accepted by chmod(1).

 

    Options:

      -p        if MODE is omitted, output in a form that may be reused as input

      -S        makes the output symbolic; otherwise an octal number is output

 

    Exit Status:

    Returns success unless MODE is invalid or an invalid option is given.

 

猜你喜欢

转载自wlcacc.iteye.com/blog/2421447