I've recently upgraded from 13.04 to 13.10 and realized my terminal bash history is not surviving reboots.

cat ~/.bash_history gave me a permissions denied error.

I, possibly unnecessarily or wrongly, issued a chmod 777 ~/.bash_history to see if that would help...and although I could then cat and read some contents it contained not much of anything as far as history.

I also tried sudo rm ~/.bash_history after reading bash history not being preserved

Strangely, after doing that, I typed a few test commands, ls, ls -lah ... and upon pressing the up arrow to go back through history it contained those two commands as well as the odd history from some far off time in the past but very few results and not the hundreds of commands I typed earlier in the day.

Is there a new place bash history is stored? How can removing ~/.bash_history not get rid of the commands that are somehow lingering? I am not certain, but I believe my root bash history is acting normal. My user bash history is what's causing me trouble. Any help and guidance in tracking down and solving this problem is appreciated.

6 Answers 6



sudo chown bob:bob ~/.bash_history && chmod 660 ~/.bash_history

the correct solution is to ensure correct permissions on your .bash_history file

  • get your user and group information using the 'id' tool. output should look like: uid=1000(myuser) gid=1000(mygroup)
  • change ownership of the file: sudo chown myuser:mygroup ~/.bash_history
  • change permissions of the file: sudo chmod 0644 ~/.bash_history

outside of /tmp there is NO problem that chmod 777 fixes. you should stop using that permission set, entirely, until you're fully aware of the implications.


Even faster without having to fiddle with chown and chmod:

Logged in as the user whose history is not saved:

sudo rm ~/.bash_history
touch ~/.bash_history

Make sure not to type any command between the 2 above


As pathetic as it sounds, this resolved itself after a reboot. I'm not sure what that means and I hate offering a resolution with such a generic solution. Maybe a reboot is necessary after removing and recreating the ~/.bash_history I'm not sure why and nowhere did I read that was a requirement. If I find out anything more specific, I will post my findings.

  • 1
    Username checks out
    – MarAvFe
    Jun 21 at 14:47

You may have got this after a software update.

I was waiting until a more reliable version of bash5 to try it out, but Ubuntu software update was waiting for it as well... and then installed it for me with the software update.

Approximately since then, I've got my long precious horse-sized .bash_history cleaned out completely...

Apparently, .bash_history is something I'd backup sometimes, just like they sync browser history. Especially if you use the same Linux distro.


Having had the same problem after installing Ubuntu 13.10. I noted that the history worked as root, and after I ran:

chmod 0777 ~/.bash_history

The problem was solved immediately.

  • 777 permission is too dangerous and unneeded, 660 would be suffice
    – Tomer Gal
    Jan 16, 2020 at 17:22

You must log in to answer this question.

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