Recover Linux terminal command history behaviour after Ubuntu upgrade

7,173

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:
7,173

Related videos on Youtube

Syed Raza
Author by

Syed Raza

Sr Principal Software Engineer(October 2013 – Present) Ebryx, Lahore Pakistan Mobile Technologies PhoneGap with (AngularJS / HTML5 / CSS3 / JQuery/ Twitter Bootstrap) JavaScript Technologies AngularJS Framework JQuery PHP Technologies Yii Framework Database SQL SERVER 2008 SQL SERVER 2008 Analysis Services (Pivot Reports, DImensions, Facts/ Measures) Webserver Apache IIS node.js Other tools Autodesk Mapserver (Google maps) Mobile Application Backend Services Sr Software Engineer(May 2012 – September 2013) IQVIS, Lahore Pakistan Ruby on Rails 3.2, JQuery, LESS/SASS, CoffeeScript, HAML. Bootstrap (Front End) Java Spring (Backend) MongoDB (Database) J2EE, Spring MVC, Tiles, Hibernate, JSTL HTML5, CSS3, JavaScript and JQuery Ubuntu Linux MYSQL, PostgreSQL, Github and Senior Software Engineer / Team Lead (Jan, 2011 – April, 2012) NextBridge PVT LTD, Lahore Pakistan Web Technology Ruby, Ruby on Rails, JQUERY, HTML 5 and CSS 3 MYSQL, PostgreSQL, Github and Mobile Technology Android SDK (Java) and Phone Gap ( JQuery, Html 5 and ) Work as Freelancer develop Software and Websites ( 2009 – Jan, 2011) PHP5, JQUERY and MYSQL Projects Shopping Carts Real Estate Sites Content Management System C#, ASP.NET and SQL SEVER 2008 Projects Web Form Applications Windows Form Applications Game Programmer (2007) IR Gurus rename to Transmission Games Studio, Melbourne Australia Team Member of Next Generation Sports Title(Cricket Ashes 2009) Game designed ( For PS3, XBOX 360 and Windows PC Platform) Publisher Code masters www.playashes.com In-House Game Engine C++, DirectX, OpenGL

Updated on September 18, 2022

Comments

  • Syed Raza
    Syed Raza almost 2 years

    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?

    • Admin
      Admin over 12 years
      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?
    • Keith Thompson
      Keith Thompson over 12 years
      Command history is handled by the shell (probably bash), not by the terminal.
  • Syed Raza
    Syed Raza over 12 years
    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'
  • Mediterran81
    Mediterran81 over 11 years
    You might also check if the file ~/.bash_history has correct persmission: sudo chmod 777 ~/.bash_history