文件搜索命令-帮助命令

man

命令名称:man
命令英文原意:manual
命令所在路径:/usr/bin/man
执行权限:所有用户
语法:man [命令或配置文件]
功能描述:获取帮助信息
例如:

查看ls命令的帮助信息
man ls

查看配置文件services的帮助信息
services文件所在目录是/etc/services
man services

man passwd

whereis passwd
passwd: /usr/bin/passwd /etc/passwd.org /etc/passwd /usr/bin/X11/passwd /usr/share/man/man1/passwd.1.gz /usr/share/man/man1/passwd.1ssl.gz /usr/share/man/man5/passwd.5.gz

在Linux中,1是命令的帮助,5是配置文件的帮助
passwd 既有命令,又有配置文件,而使用man命令查看配置文件又不能使用绝对路径(只能使用 man passwd),所以 现在使用man passwd 只能查看到命令的帮助信息,而如果想看到配置文件的帮助信息,使用 man 5 passwd

whatis

查看命令的简短信息

whatis ls
ls (1) - list directory contents whatis passwd passwd (5) - 密码文件 passwd (1) - 更改用户密码 passwd (1ssl) - compute password hashes

apropos

查看配置文件的简短信息

apropos  services 
avahi-browse (1)     - Browse for mDNS/DNS-SD services using the Avahi daemon
avahi-browse-domains (1) - Browse for mDNS/DNS-SD services using the Avahi daemon
pam_listfile (8)     - deny or allow services based on an arbitrary file
services (5)         - Internet network services list
tcpd (8)             - access control facility for internet services

apropos passwd
chpasswd (8)         - 批量更新密码
gpasswd (1)          - 管理员 /etc/group 和 /etc/gshadow
passwd (1)           - 更改用户密码
passwd (5)           - 密码文件
chgpasswd (8)        - update group passwords in batch mode
Crypt::PasswdMD5 (3pm) - Provides interoperable MD5-based crypt() functions
fgetpwent_r (3)      - get passwd file entry reentrantly
getpwent_r (3)       - get passwd file entry reentrantly
grub-mkpasswd-pbkdf2 (1) - generate hashed password for GRUB
htpasswd (1)         - Manage user files for basic authentication
lppasswd (1)         - add, change, or delete digest passwords.
mkpasswd (1)         - Overfeatured front end to crypt(3)
pam_localuser (8)    - require users to be listed in /etc/passwd
passwd (1ssl)        - compute password hashes
passwd2des (3)       - RFS password encryption
smbpasswd (5)        - The Samba encrypted password file
smbpasswd (8)        - change a user's SMB password
SSL_CTX_set_default_passwd_cb (3ssl) - set passwd callback for encrypted PEM file handling
SSL_CTX_set_default_passwd_cb_userdata (3ssl) - set passwd callback for encrypted PEM file handling
update-passwd (8)    - safely update /etc/passwd, /etc/shadow and /etc/group

命令选项 –help

比man命令更简单,更方便查询命令参数使用

 safely update /etc/passwd, /etc/shadow and /etc/group
wangyue@wangyue-um:~$ touch --help
用法:touch [选项]... 文件...
Update the access and modification times of each FILE to the current time.

A FILE argument that does not exist is created empty, unless -c or -h
is supplied.

A FILE argument string of - is handled specially and causes touch to
change the times of the file associated with standard output.

Mandatory arguments to long options are mandatory for short options too.
  -a            只更改访问时间
  -c, --no-create 不创建任何文件
  -d, --date=字符串 使用指定字符串表示时间而非当前时间
  -f            (忽略)
  -h, --no-dereference 会影响符号链接本身,而非符号链接所指示的目的地
                (当系统支持更改符号链接的所有者时,此选项才有用)
  -m            只更改修改时间
  -r, --reference=FILE use this file's times instead of current time
  -t STAMP               use [[CC]YY]MMDDhhmm[.ss] instead of current time
      --time=WORD change the specified time:
                           WORD is access, atime, or use: equivalent to -a
                           WORD is modify or mtime: equivalent to -m
      --help 显示此帮助信息并退出
      --version 显示版本信息并退出

info

命令与man命令大同小异,只是显示格式与man不用

info passwd

help

命令名称:help
命令所在路径:shell内置命令
执行权限:所有用户
语法:help 命令
功能描述:获得shell内置命令(找不到命令所在目录的命令就是内置命令)的帮助信息
例如:

shell内置命令-cd
使用man 查看
man cd
没有 cd 的手册页条目
是没结果的,
但使用 help
 help cd
cd: cd [-L|[-P [-e]] [-@]] [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: resolve symbolic links in
        DIR after processing instances of `..'
        -P  use the physical directory structure without following symbolic
        links: resolve symbolic links in DIR before processing instances
        of `..'
        -e  if the -P option is supplied, and the current working directory
        cannot be determined successfully, exit with a non-zero status
        -@  on systems that support it, present a file with extended attributes
            as a directory containing the file attributes

    The default is to follow symbolic links, as if `-L' were specified.
    `..' is processed by removing the immediately previous pathname component
    back to a slash or the beginning of DIR.

    Exit Status:
    Returns 0 if the directory is changed, and if $PWD is set successfully when
    -P is used; non-zero otherwise.


查看umask命令的帮助信息
help umask
umask: umask [-p] [-S] [模式]
    显示或设定文件模式掩码。

    设定用户文件创建掩码为 MODE 模式。如果省略了 MODE,则
    打印当前掩码的值。

    如果MODE 模式以数字开头,则被当作八进制数解析;否则是一个
    chmod(1) 可接收的符号模式串。

    选项:
      -p    如果省略 MDOE 模式,以可重用为输入的格式输入
      -S    以符号形式输出,否则以八进制数格式输出

    退出状态:
    返回成功,除非使用了无效的 MODE 模式或者选项。

尊重原创,未经允许不得转载
http://blog.csdn.net/stark_summer/article/details/48877919

你可能感兴趣的:(info,man,help,whatis,apropos)