2019-01-08 10:42:12 1304瀏覽
今天扣丁學(xué)堂Linux培訓(xùn)老師給大家介紹一下關(guān)于Linux中“!”你不知道的驚嘆用法詳解,首先在Linux工作中實(shí)際上,不起眼的“!”在linux中有著很多讓你驚嘆的妙用。本文就來細(xì)數(shù)那些“!”的神奇用法。下面話不多說了,來一起看看詳細(xì)的介紹吧。
$ whereis bash #執(zhí)行命令 bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz $ !! #再次執(zhí)行上一條命令 whereis bash bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz
$ /opt/user/test.txt #忘記輸入more $ more !! #這樣是不是快多了?
$ ls /proc/1/task/1/net/tcp /proc/1/task/1/net/tc $ ls -al !$ ls -al /proc/1/task/1/net/tcp -r--r--r-- 1 root root 0 12月 22 17:30 /proc/1/task/1/net/tcp
$ ls -al !^
$ ls -al dir #假設(shè)dir是一個很長的字符串 $ !:- ls -al
$ fin -name "test.zip" #這里find輸錯了。 $ find !* find ./ -name "test.zip" ./workspaces/shell/find/test.zip ./workspaces/shell/test.zip
$ cp -rf dira dirb/ #將dira拷貝到dirb $ ls -l !cp:2 #查看dira的內(nèi)容 ls -l dira total 0 -rw-rw-r-- 1 hyb hyb 0 12月 22 17:45 testfile
$ history (這里省略更多內(nèi)容) 2043 touch ./dira/testfile 2044 cp -rf dira dirb/ 2045 ls -al dira 2046 ls -l dira 2047 ls -al dira 2048 ls -l dira 2049 ls -al dira 2050 ls -l dira 2051 history
$ !2044 #2044是執(zhí)行的第n條命令 cp -rf dira dirb/
$ !-2 #感嘆號后面跟著一個負(fù)數(shù),負(fù)幾代表倒數(shù)第幾條
$ !find #執(zhí)行上條以find開頭的命令
$ find ./ -name "test" ./test ./find/test $ !?name? find ./ -name "test" ./test ./find/test
$ find ./ -name "old*" -a -name "*.zip"
$ !!:gs/old/new
rm !(*.cfg) #刪除需謹(jǐn)慎
以上就是關(guān)于扣丁學(xué)堂Linux培訓(xùn)解析“!”你不知道的驚嘆用法總結(jié)的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,想要了解更多內(nèi)容的小伙伴可以登錄扣丁學(xué)堂官網(wǎng)咨詢。想要學(xué)好Linux開發(fā)小編給大家推薦口碑良好的扣丁學(xué)堂,扣丁學(xué)堂有專業(yè)老師制定的Linux學(xué)習(xí)路線圖輔助學(xué)員學(xué)習(xí),此外還有與時俱進(jìn)的Linux視頻教程供大家學(xué)習(xí),想要學(xué)好Linux開發(fā)技術(shù)的小伙伴快快行動吧。扣丁學(xué)堂Linux技術(shù)交流群:422345477。
【關(guān)注微信公眾號獲取更多學(xué)習(xí)資料】
查看更多關(guān)于“Linux培訓(xùn)資訊”的相關(guān)文章>>