Ubuntu – Recover Linux terminal command history behaviour after Ubuntu upgrade

shellUbuntuubuntu 11.10

I would like to recover Linux terminal command history behaviour after updating from Ubuntu 10.04 to 11.10.

I lost the great terminal feature of accessing recent commands through the up and down arrow keys, or the command history is not being saved anymore.

Can somebody guide how to recover that behaviour?

Best Answer

If you are using BASH, your history should be stored in in the location that is pointed to by the environment variable HISTFILE. You can view this with "echo $HISTFILE". By default, this should be ~/.bash_history. This is also what will be used if $HISTFILE is not set. If HISTFILE is not set to that location, you can set it with the following:

export HISTFILE=~/.bash_history

The following will reload the history file into your history buffer:

history -r

If this does not resolve your issue, the "HISTORY" section of the bash manpage may give more clues as to why your history is not working as expected.

You may also want to check and make sure your shell has not changed from bash:

echo $0
Related Question