1. Shortcut
Ctrl-aMove to the begining of the lineCtrl-eMove to the end of the lineCtrl-uDeletes from cursor to beginning of lineCtrl-kDeletes from cursor to end of lineCtrl-wDeletes from cursor one word beforeCtrl-lsame as clear command
2. SystemInformation
free:memory informationcat /proc/cpuinfo:CPUdf:harddiskdu:folder
※ -hを付けてHelp情報を調べる
3. ファイルを一括作成
touch {apple,orange,banana}touch file_{001..100}echo {a..Z}touch {apple,banana,cherry}_{01..100}{w..d}ls -l | wc -l:计算行数,即得到当前文件夹内文件数目
4. pipe
cp -v * ../otherfolder 1>../success.txt 2>../error.txt:普通的出力输出到sucess.txt,error输出到error.txtcp -v * ../otherfolder &>../log.txt:普通的出力和error都输出到log.txtls > /dev/null:不输出,丢到类似回收站的地方echo "Some text" > file.txt:写入文件echo "Some more text" >> file.txt:追加模式写入文件> file.txt:覆盖模式,清空文件
5. grep
grep error auth.loggrep --color=auto error auth.logexport GREP_OPTIONS='--color=auto'grep -i break-in auth.loggrep -i break-in auth.log | awk {'print $12'}ping -c 1 example.com | grep 'bytes from' | cut -d = -f 4
6. 环境变量
$HOME$PWD$MACHTYPE$HOSTNAME$BASH_VERSION