许多初学者安装完一个Linux操作系统后不知从哪里入手学习Linux,特别是感觉到没有帮助信息。Linux发行版本对用户通过的技术支持时间比较短。其实当你安装了一个完整的Linux系统后,其中已经包含了一个强大的帮助,只是可能你还没有发现和使用它们的技巧。下面以RHEL 5.0为例,帮助你深入挖掘隐藏在Linux系统中的帮助信息。
B.1 命令行下帮助信息
Linux发展到今天,很多功能已经可以在可视化的界面中来完成。不过在很多情况下,命令还是非常有用的,它可以提高效率,并且可以加深对Linux系统的了解。Linux默认的Shell是Bourne Again Shell,它是Bourne Shell的扩展,简称bash,与Bourne Shell完全向后兼容,并且在Bourne Shell的基础上增加了很多特性。bash是标准的命令行"shell",也就是在Linux里等同于DOS的命令行处理器"COMMAND.COM"。bash放在/bin/bash中,可以提供如命令补全、命令编辑和命令历史表A-等功能。它有灵活和强大的编程接口,同时又有很友好的用户界面。
B.1.1 help
bash的内部命令有40个,主要包括exit、less、lp、kill、cd、pwd、fc、fg等。bash内置的命令列表A-可以通过在命令行敲入help即可获得。这些内部命令没有独立的命令程序(即你无法搜索到这些命令)和帮助文件,help命令提供这些命令的在线帮助,有趣的是help命令本身也是内部命令。下面使用help命令获取它提供帮助命令的列表:
#help GNU bash, version 3.00.15(1)-release (i386-redhat-linux-gnu) These shell commands are defined internally. Type `help' to see this list. Type `help name' to find out more about the function `name'. Use `info bash' to find out more about the shell in general. Use `man -k' or `info' to find out more about commands not in this list. A star (*) next to a name means that the command is disabled. %[DIGITS | WORD] [&] (( expression )) . filename [arguments] : [ arg... ] [[ expression ]] alias [-p] [name[=value] ... ] bg [job_spec] bind [-lpvsPVS] [-m keymap] [-f fi break [n] builtin [shell-builtin [arg ...]] caller [EXPR] case WORD in [PATTERN [| PATTERN]. cd [-L|-P] [dir] command [-pVv] command [arg ...] compgen [-abcdefgjksuv] [-o option complete [-abcdefgjksuv] [-pr] [-o continue [n] declare [-afFirtx] [-p] [name[=val dirs [-clpv] [+N] [-N] disown [-h] [-ar] [jobspec ...] echo [-neE] [arg ...] enable [-pnds] [-a] [-f filename] eval [arg ...] exec [-cl] [-a name] file [redirec exit [n] export [-nf] [name[=value] ...] or false fc [-e ename] [-nlr] [first] [last fg [job_spec] for NAME [in WORDS ... ;] do COMMA for (( exp1; exp2; exp3 )); do COM function NAME { COMMANDS ; } or NA getopts optstring name [arg] hash [-lr] [-p pathname] [-dt] [na help [-s] [pattern ...] history [-c] [-d offset] [n] or hi if COMMANDS; then COMMANDS; [ elif jobs [-lnprs] [jobspec ...] or job kill [-s sigspec | -n signum | -si let arg [arg ...] local name[=value] ... logout popd [+N | -N] [-n] printf format [arguments] pushd [dir | +N | -N] [-n] pwd [-PL] read [-ers] [-u fd] [-t timeout] [ readonly [-af] [name[=value] ...] return [n] select NAME [in WORDS ... ;] do CO set [--abefhkmnptuvxBCHP] [-o opti shift [n] shopt [-pqsu] [-o long-option] opt source filename [arguments] suspend [-f] test [expr] time [-p] PIPELINE times trap [-lp] [arg signal_spec ...] true type [-afptP] name [name ...] typeset [-afFirtx] [-p] name[=valu ulimit [-SHacdflmnpstuv] [limit] umask [-p] [-S] [mode] unalias [-a] name [name ...] unset [-f] [-v] [name ...] until COMMANDS; do COMMANDS; done variables - Some variable names an wait [n] while COMMANDS; do COMMANDS; done { COMMANDS ; }
|
上面以help命令把自己作为参数来获得自己的帮助。使用help命令提供某命令的帮助方法非常简单,在help命令后空格输入命令名称即可。
help命令提供的kill命令参数很详细,如果你对Linux有一定了解,往往只需要主要的语法,那么可以使用"-s"参数:
#help -s kill kill: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec] |
阅读(885) | 评论(0) | 转发(0) |