# history | while read cmd; do set -- $cmd; if [ $1 -gt 1000 ]; then echo "$1:$2";fi; done
1001:history
1002:set
1003:history
1004:ifconfig
1005:history
Note:
1. 預設上HISTFILESIZE是設定~/.bash_history可紀錄多少筆,預設是1000,假設今天設定成2000則代表~/.bash_history可存放2000筆記錄,於是乎上面的指令就必需改成這樣:
# history | while read cmd; do set -- $cmd; if [ $1 -gt 2000 ]; then echo "$1:$2";fi; done
2.若~/.bash_history未滿1000筆時,那就要特別注意判斷的條件了。
No comments:
Post a Comment