http://blog.csdn.net/hello_hwc
我的虚拟机系统是CentOS,版本较老,谅解
一、为什么要学习帮助命令?[root@localhost ~]# man ls LS(1) User Commands LS(1) NAME ls - list directory contents SYNOPSIS ls [OPTION]... [FILE]... DESCRIPTION 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 Written by Richard Stallman and David MacKenzie. REPORTING BUGS Report bugs to <[email protected]>. COPYRIGHT Copyright © 2006 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WAR- RANTY, to the extent permitted by law. SEE ALSO The full documentation for ls is maintained as a Texinfo man- ual. If the info and ls programs are properly installed at your site, the command info ls should give you access to the complete manual. ls 5.97 February 2010 LS(1)
这里可以看到,info ls可以给出详细描述
NAME 名字,简单的命令是用来做什么的 SYNOPSIS 简短的指令使用语法 DESCRIPTION 详细的描述命令的使用方法 OPTIONS 针对SYNOPSIS,进行详细的阐述 COMMANDS 执行的时候可下达的命令 FILES 指令相关的文件 SEE ALSO 和这个指令相关的命令 EXAMPLE 范例 BUGS 尚存在的漏洞 COPYRIGHT 版权信息 REPORTING BUGS 发现Bug可以上传的邮箱 AUTHOR 作者
1 指令或者可执行文档 2 内核可调用的函数 3 常用函数库 4 档案说明 5 档案格式 6 游戏 7 linux系统的说明性内容 8 root可用的管理命名 9 和内核相关的文件
[root@localhost ~]# file --help Usage: file [OPTION]... [FILE]... Determine file type of FILEs. -m, --magic-file LIST use LIST as a colon-separated list of magic number files -z, --uncompress try to look inside compressed files -b, --brief do not prepend filenames to output lines -c, --checking-printout print the parsed form of the magic file, use in conjunction with -m to debug a new magic file before installing it -f, --files-from FILE read the filenames to be examined from FILE -F, --separator string use string as separator instead of `:' -i, --mime output mime type strings -k, --keep-going don't stop at the first match -L, --dereference causes symlinks to be followed -n, --no-buffer do not buffer output -N, --no-pad do not pad output -p, --preserve-date preserve access times on files -r, --raw don't translate unprintable chars to \ooo -s, --special-files treat special (block/char devices) files as ordinary ones --help display this help and exit --version output version information and exit
查找whatis的数据库,寻找关键字的描述信息。在我们学会了man之后,可以直接man whatis来看信息
使用场合:我们想知道这个命令使用来干嘛的,或者我们想知道这个命令的种类
[root@localhost ~]# whatis ls ls (1) - list directory contents ls (1p) - list directory contents [root@localhost ~]# whatis CD cd (1p) - change the working directory cd [builtins] (1) - bash built-in commands, see bash(1)
[root@localhost ~]# cd --help bash: cd: --: invalid option cd: usage: cd [-L|-P] [dir] [root@localhost ~]# help cd cd: cd [-L|-P] [dir] Change the current directory to DIR. The variable $HOME is the default DIR. 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, i.e. `.'. 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, then try the word as a variable name. If that variable has a value, then cd to the value of that variable. The -P option says to use the physical directory structure instead of following symbolic links; the -L option forces symbolic links to be followed.
alias, bg, bind, break, builtin, cd, command, compgen, complete, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, sus- pend, test, times, trap, type, typeset, ulimit, umask, una- lias, unset, wait