5.使用命令(快樂的LInux命令行)

  1. 命令集合(type – 說明怎樣解釋一個命令名 which – 顯示會執行哪個可執行程序  man – 顯示命令手冊頁 apropos – 顯示一系列適合的命令 info – 顯示命令  whatis – 顯示一個命令的簡潔描述 alias – 創建命令別名)
  2. type - 顯示命令的類型 (type command)
  3. which-顯示一個可執行程序的位置 (which command 注:內建命令和命令別名不顯示)
  4. help - 得到 shell 內建命令的幫助文檔 (help command 或者 command  --help
  5. man - 顯示程序手冊頁 (man [section] command 以下格式不一定都有)
    章節 內容
    1 用戶命令
    2 程序接口內核系統調用
    3 C 庫函數程序接口
    4 特殊文件,比如說設備結點和驅動程序
    5 文件格式
    6 遊戲娛樂,如屏幕保護程序
    7 其他方面
    8 系統管理員命令
  6. apropos 顯示適當的命令(apropos key 就是模糊的查找指令)
  7. whatis - 顯示非常簡潔的命令說明(名稱 + 一行命令說明)
  8. info - 顯示程序 Info 條目( info 用 n p 可跳轉到索引節點,像超鏈接,但是不如man容易使用,反而效果不好)
  9. alias - 創建你自己的命令(alias name='String'
  10. 多用文檔和搜索
  11. 代碼操作
    [me@linuxbox ~]$ type type
    type is a shell builtins
    [me@linuxbox ~]$ type ls
    ls is aliased to `ls --color=tty`
    [me@linuxbox ~]$ type cp
    cp is /bin/cp
    
    [me@linuxbox ~]$ which ls
    /bin/ls
    [me@linuxbox ~]$ which cd
    /usr/bin/which: no cd in
    (/opt/jre1.6.0_03/bin:/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/opt/jre1
    .6.0_03/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/home/me/bin)
    
    [me@linuxbox ~]$ help cd
    cd: cd [-L|-P] [dir]
    Change ...
    [me@linuxbox ~]$ mkdir --help
    Usage: mkdir [OPTION] DIRECTORY...
    Create ...
    
    [me@linuxbox ~]$ man ls
    [me@linuxbox ~]$ man 5 passwd
    
    [me@linuxbox ~]$ apropos floppy
    create_floppy_devices (8)   - udev callout to create all possible
    ...
    
    [me@linuxbox ~]$ whatis cd
    cd                   (1p)  - change the working directory
    
    [me@linuxbox ~]$ info info
    File: coreutils.info,    Node: ls invocation,    Next: dir invocation,
     Up: Directory listing
    
    10.1 `ls': List directory contents
    ==================================
    ...
    
    [me@linuxbox ~]$ cd /usr; ls; cd -
    bin  games    kerberos  lib64    local  share  tmp
    ...
    
    [me@linuxbox ~]$ type test
    test is a shell builtin
    [me@linuxbox ~]$ type foo
    bash: type: foo: not found
    [me@linuxbox ~]$ alias foo='cd /usr; ls; cd -'
    [me@linuxbox ~]$ foo
    bin   games   kerberos  lib64    local   share  tmp
    ...
    [me@linuxbox ~]$ type foo
    foo is aliased to `cd /usr; ls ; cd -'
    [me@linuxbox ~]$ unalias foo
    [me@linuxbox ~]$ type foo
    bash: type: foo: not found
    [me@linuxbox ~]$ type ls
    ls is aliased to 'ls --color=tty'
    [me@linuxbox ~]$ alias
    alias l.='ls -d .* --color=tty'
    ...
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章