Hack 56. Change the history file name using HISTFILE

By default, history is stored in ~/.bash_history file. Add the following line to the .bash_profile and relogin to the bash shell, to store the history command in .commandline_warrior file instead of .bash_history file. I’m yet to figure out a practical use for this. I can see this getting used when you want to track commands executed from different terminals using different history file name.

# vi ~/.bash_profile

Comments on this entry are closed.

  • George January 21, 2014, 7:29 am

    This is useful for when you want to relocate your history file outside of your home directory. There’s a variety of practical applications. This is required on certain platforms like HP-UX when you’re using an NFS mounted home filesystem. Also handy when you want your history erased between reboots; mount /tmp as tmpfs in RAM, and put your bash history file on /tmp.

  • Aman February 20, 2014, 4:18 am

    This is used, when you don’t want user to access his history files and want to keep it for audit purpose.