linux之shell命令之一
第一:cat使用
cat -n filename | more :新增行號
cat >filename 接著輸入新的內容 :建立一個新的檔案
cat -b filename | more :與-n 一樣,只不過對於空白行不編號(number-nonblank)
cat -b -s filename | more :與-n 一樣,當遇到有連續兩行以上的空白行,就代換為一行的空白行(sequeeze-blank)
cat -v filename: 顯示非列印字元(show-nonrinting)
第二: tee使用
tee命令例項
tee指令會從標準輸入裝置讀取資料,將其內容輸入到標準輸出裝置,同時儲存成檔案
cat qilin.txt |tee qilin_1.txt qilin_2.txt qilin_3.txt:列出文字檔案qilin.txt的內容,同時複製3份副本,檔名分別為qilin_1.txt qilin_2.txt qilin_3.txt
ls -l |tee saijuan.txt:列出當前的目錄,並把結果輸入到saijuan.txt裡
第三:echo使用
echo -e "nihao qilin \n\n\n" : -e 轉移字元 表示輸出換行 -t 空格
echo "\"/dev/rmt0"\" 輸出內容是 "/dev/rmt0" :引號是一個特殊字元,所以必須要使用反斜槓\來使shell 忽略它的特殊含義
第四:&& || awk 的使用
cp /etc/passwd /etc/passwd.bak && echo "if you are seeing this then cp was ok"
cp /etc/passwdwww /etc/passwd.bak || echo "if you are seeing this then cp was ok"
第五: awk的使用
awk '{print$1,$5}' passwd >passwd.tmp || echo "sorry that work didnt't work" | mail rootman
第六:.代表當前檔案位置
第七: grep的使用
grep -n "root" passwd.txt :-n 表示顯示行號並且顯示查詢出的所在位置
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20976446/viewspace-686943/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- linux之shell awk 之一Linux
- Linux Shell之sort命令(轉)Linux
- Linux Shell指令碼系列之一Linux指令碼
- 強大好用的shell之shell命令
- Linux shell命令總結Linux
- Linux基本命令學習之一:Linux基本命令Linux
- linux自定義shell(bash)命令Linux
- linux之shell findLinux
- linux之shell 其他Linux
- linux Shell 命令列-03-array Shell 陣列Linux命令列陣列
- Linux基礎命令---enable開啟shell命令Linux
- 命令列與Shell -> 文字處理命令之sed命令列
- Linux SHELL if 命令引數說明Linux
- linux shell 互動, read 命令Linux
- 【LINUX】linux 常用命令精選_之一Linux
- Linux之shell變數Linux變數
- Linux Shell之表示式Linux
- Hadoop Shell命令 |HDFS Shell命令| HDFS 命令Hadoop
- awk小技巧之執行shell命令
- hbase之 Hbase shell 常用命令
- 說說Linux shell外部命令與內建命令Linux
- linux命令 之 du 命令Linux
- Linux命令之lldptool命令Linux
- Linux命令和shell指令碼學習Linux指令碼
- linux||mac os如何自定義shell命令LinuxMac
- 37條常用Linux Shell命令組合Linux
- Linux Shell命令換行問題(轉)Linux
- Linux快速編輯Shell命令列(轉)Linux命令列
- 51、linux shell命令,route,ifconfigLinux
- Linux Shell 之 我的第一個Shell程式Linux
- Linux之shell程式設計Linux程式設計
- linux之shell awk 之二Linux
- Shell命令
- MongoDB 學習筆記之常用 shell 命令MongoDB筆記
- aix_shell入門之一AI
- 一些Linux shell命令 - 持續更新Linux
- shell指令碼linux命令連續執行指令碼Linux
- Linux Shell程式設計(20)——基本命令Linux程式設計