Linux学习之获取帮助

基于系统本身的在线联机帮助

一、命令手册 manual

命令格式: (调用路径:/usr/share/doc/man)

man command

man分章节的,具体内容如下:

1、user command:用户命令,任何人可用

2、system call:系统调用

3、库调用:library call,只有库才有库调用

4、特殊文件(设备文件)

5、文件格式(配置文件的语法) ,example: man 5 passwd

6、games

7、杂项(miscellaneous)

8、管理命令(/sbin、/usr/sbin、/usr/local/sbin)

 

whatis command 查看命令在man的哪一个章节中(第二列为标示章节)

 

1
2
3
4
5
[lovelace@lovelace ~]$ whatis  echo
echo                  (1)  - display a line of text
echo                  (1p)  - write arguments to standard output
echo  [builtins]      (1)  -  bash  built- in  commands, see  bash (1)
echo  [curs_inopts]   (3x)  - curses input options

 

Note: 需要注意的一点:

< >内选项为必须选项

[ ]内选项为可选选项

…可以重复多次使用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[lovelace@lovelace ~]$  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.
AUTHOR
Written by Richard Stallman and David MacKenzie.
REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.
COPYRIGHT
Copyright (C) 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 WARRANTY, to
the extent permitted by law.
SEE ALSO
The full documentation  for  ls  is maintained as  a  Texinfo  manual.
If  the  info  and  ls  programs are properly installed at your site,
the  command
info  ls
should give you access to the complete manual.

man commad页面中各个条目的意思

name:命令名称及功能简要说明

sysnopsis:用法说明,包括可用的选项

description:命令功能的详尽说明,报考每一个选项的意义

options:说明每一个选项的意义

files:此命令相关的配置文件

bugs:提供bug给原作者

examfiles:使用示例

see also:另外参照

man翻屏操作

向后翻一屏

向前翻一屏

向后翻一页

向前翻一页

man手册中进行查找

/keyword   从前向后查找

?keyword 从后向前查找

n:下一个匹配选项

N:上一个匹配选项

二、info信息页

info和man功能类似,只是是获得指令的信息页,带有很多注解和范例(info只存在于linux上,unix上不支持)

语法格式:

info command

?显示info的使用帮助  

b/t/home返回文档的开始节点  

e/end返回该文档的结束节点  

1
2
3
4
5
6
7
8
9
10
11
Basic Commands  in  Info Windows
******************************
C-x 0       Quit this help.
C-x C-c     Quit Info altogether.
h           Invoke the Info tutorial.
Selecting other nodes:
----------------------
n           Move to the  "next"  node of this node.
p           Move to the  "previous"  node of this node.
u           Move  "up"  from this node.
m           Pick menu item specified by name.

三、help指令获得帮助

help有两种使用方式  

1、help command(此方式只针对系统内建命令) 类似man –k 功能

help后面不跟命令 则会列出所有命令 (非内建命令会报错)

参数说明: 

-s只显示少量信息 

1
2
3
4
5
[lovelace@lovelace ~]$ help  ls
- bash : help: no help topics match ` ls '.  Try `help help'  or ` man  -k  ls ' or `info ls' .
[lovelace@lovelace ~]$  type  set ;help -s  set
set  is a shell  builtin
set set  [--abefhkmnptuvxBCHP] [-o option] [arg ...]

怎么判断哪个命令是内置命令:

方法一

type command,查看返回结果就可以知道命令是不是内置命令, 

type的另一个功能就是能看查看指令是否有别名 

1
2
3
4
[lovelace@lovelace ~]$  type  ls
ls  is aliased to ` ls  --color= tty '
[lovelace@lovelace ~]$  type  echo
echo  is a shell  builtin

方法二

compgen –b列出系统中所有内置命令 

1
2
3
4
5
6
7
8
9
10
11
12
[lovelace@lovelace ~]$ compgen -b
.
:
[
alias
bg
bind
break
builtin
caller
cd
command

方法三 

man builtin:列出系统中所有内建命令 

1
2
3
4
5
6
7
8
9
10
[lovelace@lovelace ~]$  man  builtin
BASH_BUILTINS(1)                                              BASH_BUILTINS(1)
NAME
bash ,  :, ., [,  alias bg , bind,  break builtin cd command , comp-
gen, 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 ,  suspend,  test times trap ,
type , typeset,  ulimit umask unalias unset , wait -  bash   built- in
commands, see  bash (1)

2、command –help(适用于外部命令)

1
2
3
4
5
6
7
8
9
[lovelace@lovelace ~]$  type  set
set  is a shell  builtin
[lovelace@lovelace ~]$  set  --help
bash set : --: invalid option
set : usage:  set  [--abefhkmnptuvxBCHP] [-o option] [arg ...]
[lovelace@lovelace ~]$  ls  --help
Usage:  ls  [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically  if  none of -cftuvSUX nor -- sort .

基于系统之外的在线联机帮助

 四、论坛获得帮助

知名论坛CU(chinaunix)、linuxsir等等,就算没有人回答你的问题,呼叫版主,斑竹也会对你的问题做解答。 而且从不同的答案中你能获得额外额惊喜j_0003.gif

弊端是延迟性未知,因为斑竹不可能一直盯着电脑等待回复网友们所发布的信息。。。 

另外推荐一些经常要光顾的linux论坛或网站的指导文章:http://magedu.com/linuxweb.html

五、官网获得帮助

官方文档是最好的获取相关知识的地方,但是相对于E文不是太好的同学来讲,同时由于中文翻译的延后性和不明所以的错误,这对好多人来说是一件很痛苦的事情,好处是权威性不容质疑。 

六、QQ获得帮助

在QQ群里提问问题,百分之八十是没有结果的,具体原因你懂的j_0031.gif…… 

七、后记

一般建议使用man命令来进行指令的帮助获取,上面列出的只是man的一小部分,其实man强大的功能并非一句两句能够讲清楚的。希望能对你的学习带来帮助......



本文转自lovelace521 51CTO博客,原文链接:http://blog.51cto.com/lovelace/1200893,如需转载请自行联系原作者

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值