以下就是我常用卻又很重要的指令
#1 用mutt login 到localhost的imap
mutt -f imap://user@localhost#2 用du show /home/* 的使用量不包含子目錄內
# -s, --summarize display only a total for each argument#3 網路校時
du -s /home/*
du -s /home/*|sort -nr 這個就比較有威力了吧
du -s /home/*|sort -nr|awk -F\ '{ print $1}' #這個是萃取容量大小的欄位
ntpdate tock.stdtime.gov.tw && /sbin/hwclock -w#4 DNS Query
dig#5 去除重複
dig [@server] [FQDN] [type]
dig yahoo.com.tw MX #使用你預設的DNS查詢yahoo.com.tw的MX
dig 168.95.1.1 yahoo.com.tw NS #使用CHT的DNS查詢yahoo.com.tw的NS
uniq#6 壓縮/解壓縮
cat afile.txt | sort | uniq >> bfile.txt
sort -u 也可以做到uniq
壓縮#7 數值運算
tar -zcvf filename.tar.gz /path/target
解壓縮
tar -zxvf filename.tar.gz
檢視壓縮內的檔案內容
tar -ztvf filename.tar.gz
bash做數值運算#8 ls 按照時間排序
echo "(865999.1/1024000.2)*100"|bc -l
echo "$(echo "scale=3; 8900000/1000000"|bc -l)"
ls -alr --time-style=long-iso --sort time|less#9 dig 反解
dig -x x.x.x.x#10 Query目錄內檔案或目錄絕對路徑
檔案的絕對路徑#11 顯示encodeing Base64的中文字
find /home/10946/ -type f
目錄的絕對路徑
perl -MMIME::Base64 -MEncode=decode -n -00 -e 's/\n //g;s/(?<=:: )(\S+)/decode("UTF-8",decode_base64($1))/eg;print'#12 加總來自非公司內部的信件容量
使用方式是加在pipe後面
from perlmonks.org
awk '/: from=</ && !/taiyi/ { print $8}' /var/log/mail.log|awk -F"size=" '/[0-9]/ { sum+=$2} END {print sum/1024/1024}'#13 LVM
lvcreate -L 9G -n root vgpoollvcreate -l 100%FREE -n swap vgpoollvextend -l +100%FREE /dev/vgpool/root
沒有留言:
張貼留言