tags:

views:

502

answers:

2

Hello,

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?

+5  A: 

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
Robert Gamble
HISTFILE and HISTSIZE also work for Korn shell - this was the answer I'd've given had Robert not gotten there first.
Jonathan Leffler
+1  A: 

You might also want to check this out - http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history

Aswin Anand