history: history [-c] [-d 偏移量] [n] 或 history -anrw [文件名] 或 history -ps
栗子:
1. history // 顯示所有使用的歷史命令列表
2. history 10 // 顯示最近使用的10條命令
3. history -w // 將歷史命令寫入 ~/.bash_history文件
4. echo $HISTSIZE // 顯示系統會記錄的命令條數
5. !5 // 執行第五條命令
6. !! // 執行上一條命令
7. !ec // 執行最近以ec開頭的命令
問題:
1. 同一帳號同時多次登錄的history寫入問題
2. 無法記錄時間
答案參見《鳥哥的Linux私房菜》p319