二、幫助

命令類型:內置命令(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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章