六月丁香五月婷婷,丁香五月婷婷网,欧美激情网站,日本护士xxxx,禁止18岁天天操夜夜操,18岁禁止1000免费,国产福利无码一区色费

學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

Linux的Bash命令怎么使用

時(shí)間: 孫勝龍652 分享

  Bash是Bourne-Again SHell的縮寫,是許多Linux平臺(tái)內(nèi)定的shell,其實(shí)Bash命令有許多操作技巧,很多初學(xué)者可能還不知道,掌握這些技巧能夠更快的完成工作,一起來和學(xué)習(xí)啦小編學(xué)習(xí)下吧。

  tab鍵補(bǔ)全用法

  當(dāng)我們敲擊一下tab補(bǔ)全命令或文件名

  當(dāng)我們敲擊兩下tab 列出相關(guān)的所有可選項(xiàng)

  cd - 相當(dāng)于電視的回看

  有時(shí)候我們進(jìn)入一個(gè)非常長(zhǎng)的目錄,后來又進(jìn)入另一個(gè)目錄,可能我們還行回到原來那個(gè)長(zhǎng),如果事先知道,我們可能輸入pwd ,以便一會(huì)兒粘貼,有時(shí)候忘了輸入pwd我們可能無奈還得輸入一次長(zhǎng)長(zhǎng)的路徑,我們可以輸入一下cd -試試,直接回到上次進(jìn)入的目錄,就像是看電視時(shí)候的回看按鈕。是不是很好用?

  查看以下例子

  [root@localhost /]# cd /tmp

  [root@localhost tmp]# pwd

  /tmp

  [root@localhost tmp]# cd /

  [root@localhost /]# pwd

  /

  [root@localhost /]# cd -

  /tmp

  [root@localhost tmp]# pwd

  /tmp

  Esc+.

  用法舉例

  首先touch一個(gè)文件,然后編輯這個(gè)文件

  touch abcdefghijk

  敲入vi ,然后Esc+. 發(fā)現(xiàn)是不是abcdefghijk已經(jīng)出現(xiàn)在vi后面\

  轉(zhuǎn)義字符用法

  系統(tǒng)中一些命令都是別名的功能,比如我們使用的rm、mv等,實(shí)際上是 rm -i和mv -i 。

  查看系統(tǒng)別名可以使用alias命令,例如以下系統(tǒng)默認(rèn)的別名。

  [root@localhost testdir]# alias

  alias cp=‘cp -i’

  alias egrep=‘egrep --color=auto’

  alias fgrep=‘fgrep --color=auto’

  alias grep=‘grep --color=auto’

  alias l.=‘ls -d .* --color=auto’

  alias ll=‘ls -l --color=auto’

  alias ls=‘ls --color=auto’

  alias mv=‘mv -i’

  alias rm=‘rm -i’

  alias which=‘alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde’

  有時(shí)候我們刪一個(gè)文件時(shí)候,會(huì)出現(xiàn)以下提示, 需要我們一個(gè)個(gè)確認(rèn),原因就是rm默認(rèn)就是rm -i起了作用。

  [root@localhost testdir]# cd dir1

  [root@localhost dir1]# ls

  file1 file2 file3 file4

  [root@localhost dir1]# rm file1 file2 file3 file4rm: remove regular empty file ?.ile1?。 y

  rm: remove regular empty file ?.ile2?。 y

  rm: remove regular empty file ?.ile3?。 y

  rm: remove regular empty file ?.ile4?。 y

  我們可以使用轉(zhuǎn)移字符使別名失效,使用如下,刪除就不會(huì)再有提示確認(rèn)了。

  [root@localhost testdir]# cd dir1

  [root@localhost dir1]# ls

  file1 file2 file3 file4

  [root@localhost dir1]# \rm file1 file2 file3 file4

  上面就是bash命令的操作技巧的介紹了,想要學(xué)的精,光掌握命令是不夠的,還要靈活應(yīng)用一些操作技巧,這樣才能事半功倍,你學(xué)會(huì)了嗎?

307886