1. 程式人生 > >Shell 特性:history

Shell 特性:history

format 參數 oot roo etc 存在 記錄 size sts

[[email protected] ~]# history    # 查看命令歷史,命令歷史存在 ~/.bash_history 文件中
[[email protected] ~]# !!         # 表示執行上一條命令
[[email protected] ~]# ls !$      # 表示上一條命令的最後一個參數
[[email protected] ~]# !950       # 表示執行命令歷史中的第 950 條命令
[[email protected] ~]# !ls        # 表示執行命令歷史中最近的一條以 ls 開頭的命令

echo "HISTFILESIZE=2000" >> /etc/bashrc                   # 設置最多能存儲 2000 條歷史命令
echo "HISTSIZE=2000" >> /etc/bashrc                       # 設置執行 history 這個命令後最多輸出 2000 條記錄
echo "export HISTTIMEFORMAT=\"%F %T \"" >> /etc/bashrc    # 設置歷史命令的記錄格式

Shell 特性:history