天天看点

二、帮助

命令类型:内置命令(shell内置)

          外部命令(在文件系统某个路径下有一个与命令名称相应的可执行文件)

    外部命令查找依赖于PATH变量

查看外部命令搜索路径,查看PATH变量:

[root@www ~]# echo $PATH

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

(路径用:隔开)

type:显示指定命令属于哪种类型

[root@www ~]# type su

su is /bin/su (外部命令)

which:shows the full path of (shell) commadns  查看命令所在路径

which [options] [--] programname [...]

[root@www ~]# which su

/bin/su

获得命令的使用帮助

1)whatis command

 [root@www ~]# whatis su

su                   (1)  - run a shell with substitute user and group IDs 

(1) 表示章节

2)help :displays brief summaries of builtin commands

内部命令: help command

外部命令: command --help

 [root@www ~]# su --help

用法:su [选项]... [-] [用户 [参数]... ]

Change the effective user id and group id to that of USER.

3)man(manual 命令手册)

man command 

man 通常分为8个章节:

(1)用户命令

(2)系统调用

(3)库调用

(4)特殊文件(硬件文件)

(5)文件格式(配置文件的语法)

(6)游戏

(7)杂项(miscellaneous)

(8)管理命令

man翻屏:

   向后翻一屏:space

   向前翻一屏:b

   向后翻一行:enter

   向前翻一行:k

man查找:

   /keyword :向后搜

  ?keyword :向前搜

      n     : 下一个

      N     : 前一个

q:退出man

 [root@www ~]# man su

SU(1)                            User Commands                           SU(1)

NAME

       su - run a shell with substitute user and group IDs

SYNOPSIS

       su [OPTION]... [-] [USER [ARG]...]

4)在线文档:info command

5)文档:/usr/share/doc

练习:

1)echo是内部命令还是外部命令

 [root@www ~]# type echo

echo is a shell builtin

echo是内部命令

2)作用

echo --- display a line of text

3)换行显示 “123456.abcdef"

[root@www ~]# echo -e "123456\nabcdef"

123456

abcdef