Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Dec 5 '11 at 6:31

This question came from our site for professional and enthusiast programmers.

Do you mean that the 'history' command doesn't work anymore? Or that you can't use emacs-style searching (C-S, C-R)? What feature are you missing specifically? – Dave Dec 4 '11 at 20:57
Command history is handled by the shell (probably bash), not by the terminal. – Keith Thompson Jan 20 '12 at 0:23

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
share|improve this answer
these command are not helpful which you mentioned.. Everything you asked me to check is already the same like as u asked.. but still not helpful. I tried this command still not help ful "sudo gedit /home/administrator/.bash_history" output is this 'code' cd /etc/default/ nano console-setup exit 'code' – Syed Raza Dec 11 '11 at 12:55
You might also check if the file ~/.bash_history has correct persmission: sudo chmod 777 ~/.bash_history – Mediterran81 Sep 29 '12 at 0:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .