export HISTTIMEFORMAT='%F %T ' history
若要永久顯示請進入根目錄修改 .bash_profile
cd vi .bash_profile
最後一行加入export HISTTIMEFORMAT='%F %T ' 加下
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin export PATH unset USERNAME export HISTTIMEFORMAT='%F %T '
使用history指令查詢會出現日期時間
1998 2014-12-03 18:31:28 iftop
1999 2014-12-03 18:31:28 htop
2000 2014-12-03 18:31:28 ethstatus
2001 2014-12-03 18:31:35 apt-get -y upgrade