Add Timestamps to Bash History
Add the following lines
# Setup timestamps for History export HISTTIMEFORMAT="%h/%d -- %H:%M:%S "
Now when you type history each command will have a time-stamp attached:
1117 Nov/28 -- 23:20:37 exit 1118 Dec/02 -- 09:30:18 vi .bashrc 1119 Dec/02 -- 09:32:23 history
Remove Duplicate Commands
# Ignore duplicate commands HISTCONTROL=ignoreboth
Increase History Size
# Increase history lines to 10 000 HISTSIZE=10000
Search History Dynamically
A useful tip that everyone should know is how to search history in place.
ctrl+r (reverse-i-search)`named': vi /var/named/house.local.zoneWhen you press ctrl+r it will bring up a reverse history search in which you can type a quick search query and it will bring up the most recent occurrence of that word that you have typed for quick execution.