0755mx 发表于 2015-10-25 14:02:38

RHCE笔记整理-RH033.Unit4-The Bash shell

RHCE笔记整理-RH033.Unit4-The Bash shell

[*]Bash :Bourne Again Shell
作用:将用户输入的指令解析成linux kernel能够识别的语言,是用户与系统勾通的桥梁。
[*]Bash 历史
       |--System V:sh--------->Bash
Unix|                                                 |
               |--BSD:csh-->ksh                      |
                                        tchsh------------|
                                        zsh
    3. File Globbing

[*]Globbing is wildcard expansion
            *      mathes zero or more characters
            ?      matches any single character
                matches a range of characters
            [^a-z]    matches all except the range
    4. The Tab Key
    5. History
      Command:history
      Usage:


[*]history命令结果 会输出指令的序号和指令的名称,要使用某一序号的指令,可进行如下操作:!指令序号
[*]要修改上一条指令可进行操作:^source^dest
例:#ping 192.168.1.123
       #^123^1
       则修改后的指令为ping 192.168.1.1

    6. The Use Of Tilde(~)

[*]Back to home directory
$cd ~
[*]change to other user's home directory
$cd ~username
    7.如何在指令里使用变数及{}
    8. 如何有摊中加入其它指令来显示电脑信息及用指令进行数学运算

[*]Command output      '' or $()
例:$echo "Hostname:`hostname`"
   or $echo "Hostname:$(hostname)"
[*]数学运算:$[]
例:$a=3
       $b=5
       $c=7
       $echo $[$a+$b]   //a+b
       $echo $[$a**$b]//a的b次方
建议使用时各参数都用空白隔开,这是标准的语法,各平台上都可以使用
    9. Backslash

[*]Backslash is the escape character
例:$echo Your cost is $5.00
      $Your cost is .00
      $echo Your cost is /$5.00
      $Your cost is $5.00
    10. The use of quotes

[*]quoting prevents expansion

[*]Single quotes(`)      inhibitall expansion
[*]Double quotes(")    inhibit all expansion except

[*]$
[*]/
[*]`
[*]!


    11. HistoryTricks

[*]use up and down to sroll through previous commands
[*]type <CTRL-R> to search ro command
[*]To recall last argument from previous commands:
<esc>.      先按ESC,放开后再按“。”
<Alt-.>   同时按下Alt+.
    12. Command Editing Tricks

[*]By default bsh uses emacs-style
[*]type &quot;set-o vi&quot; to change keybinding ro vi-style

[*]set -o查看电脑上的设定
[*]切换编辑模式:
set -o vi 把默认的编辑器改为vi,其中-o表示“减off&quot; 即为“on&quot;


    13. Gnome-terminal

[*]<ctrl+shift+t>   open a new tab
[*]<ctrl+PgUp/PgDn>    Next/Previous tab
[*]<alt-&quot;N&quot;>                   change to goto &quot;N&quot; tab
[*]<ctrl+shift+c/v>   copy/paste
[*]<ctrl+shift+w>      close a tab
            版权声明:本文为博主原创文章,未经博主允许不得转载。
页: [1]
查看完整版本: RHCE笔记整理-RH033.Unit4-The Bash shell