tree:查看目錄權限
mkdir:創建目錄
-p = parent 父級目錄
-v = verbose 詳細過程
mkdir -pv /mnt/test/{x/m,y} mkdir -pv /mnt/test/{a,d}_{b,c}
命令行展開:
第一個會創建目錄:/mnt/test/x/m 和 /mnt/test/y
第二個會創建目錄:/mnt/test/a_b,/mnt/test/a_c,/mnt/test/d_b,/mnt/test/d_c
touch:
主要用途是改變文件的時間戳
-m:modify 修改時間
-a:access 訪問時間
-t:設置時間
可創建文件:touch a 則創建文件a
查看文件:
cat
-n:顯示行號
-E:顯示行末尾字符
more:分屏顯示
less:分屏顯示
head:顯示前幾行
tail:顯示後幾行
-f:調試時候會用到,剛寫入文件的內容 立馬顯示
cut:
-d:分隔符
-f:第幾個字段
cut -d ' ' -f 3-4 /opt/logs/log-2017-05-04.php 2017-05-04 17:17:39 2017-05-04 17:17:39 2017-05-04 17:18:09 2017-05-04 17:18:09
sort
-f:忽略大小寫
-u:重複不顯示
-n:以數字形式排序
-r:倒序
-t:字段分隔符
-k:字段數
sort -r -t ' ' -k 4 /opt/logs/log-2017-05-04.php ERROR - 2017-05-04 17:18:09 --> Severity: Warning --> stream_select(): unable to select [4]: Interrupted system call (max_fd=5) ERROR - 2017-05-04 17:18:09 --> Severity: Warning --> stream_select(): unable to select [4]: Interrupted system call (max_fd=5) ERROR - 2017-05-04 17:17:39 --> Severity: 8192 --> mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead ERROR - 2017-05-04 17:17:39 --> Severity: 8192 --> mysql_pconnect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
uniq
-d:只顯示重複行
-D:顯示重複行(多行)
-c:重複次數
\rm:還原rm命令最原始的作用