I have a FreeBSD box with Bash set up.
I'm used to Debian Linux where my command history is automatically saved when I log out, so that when I log back in I can press up or Ctrl-R or whatever and have access to my history.
How do I set up Bash to do this on FreeBSD?
In Bash, your command history is stored in a file ( . bash_history ) in your home directory.
The command is simply called history, but can also be accessed by looking at your . bash_history in your home folder. By default, the history command will show you the last five hundred commands you have entered.
When you log out, the specified number of lines from the csh history list will be saved in a file called . history in your home directory. zsh, bash and ksh use the filename given in the HISTFILE environment variable. By default, bash calls the file .
The Bash version of history allows for reverse searches, quick recall, rewriting history, and more. Display or manipulate the history list.
Check your environment to make sure the variables HISTSIZE and HISTFILE are set. Make sure HISTSIZE (the number of commands to save) is large enough (I use 10000) and that HISTFILE is writeable. If these variables are not defined, set then in your ~/.bashrc file, logout and log back in.
[EDIT] Also, be sure to check that history is enabled by running:
set -o
and looking for "history":
history on
If history is off
you can turn it on with
set -o history
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With