Linux系统学习之帮助命令(5)

2017-07-08  本文已影响0人  小荷才

man帮助命令

man [选项] 命令
选项:
-f //查看命令拥有那个级别的帮助
-k //查看和命令相关的所有帮助
man的级别:
1. 查看命令的帮助
2. 查看可被内核调用的函数的帮助
3. 查看函数和函数库的帮助
4. 查看特殊文件的帮助(主要在/dev文件夹下)
5. 查看配置文件的帮助
6. 查看游戏的帮助
7. 查看其他杂项的帮助
8. 查看系统管理员可用命令的帮助

例子:

[root@centos ~]# man ls
//表示命令级别                     //表示用户命令
LS(1)                            User Commands                           LS(1)

NAME
       ls - list directory contents //命令的说明

SYNOPSIS
       ls [OPTION]... [FILE]... //命令的使用方法

DESCRIPTION //下面内容是ls的选项与简化选项
       List  information  about  the FILEs (the current directory by default).
       Sort entries alphabetically if none of -cftuvSUX nor --sort.

       Mandatory arguments to long options are  mandatory  for  short  options
       too.

       -a, --all
              do not ignore entries starting with .

       -A, --almost-all
              do not list implied . and ..

       --author
              with -l, print the author of each file
//如果命令的选项很多,在此处可以查找你需要的命令
//输入/-关键字 就可以自动跳转到含有关键字的命令上,如:/-d 搜索含有d的选项
//搜索后按n键是跳往下一个,shift是跳往上一个
:

注:man命令在某些版本下需要先安装,方法如下:

yum install man*

--help命令

获取命令“选项”的帮助

命令 --help
例如:ls --help

shell内部命令帮助

获取shell内部命令帮助

help shell内部命令
例如:help cd

注:使用whereis区分命令是否是shell内部被命令,例如:

[root@centos ~]# whereis ls
//显示了ls命令的执行文件/bin/ls 说明这个命令不是shell内部命令
ls: /bin/ls /usr/share/man/man1/ls.1.gz /usr/share/man/man1p/ls.1p.gz
[root@centos ~]# whereis cd
//只显示的cd的帮助文件  没有显示他的执行文件,说明cd是shell内部命令
cd: /usr/share/man/man1/cd.1.gz /usr/share/man/man1p/cd.1p.gz

上一篇下一篇

猜你喜欢

热点阅读