3

After an OS update, my bash history is suddenly gone - typing "history" at a terminal window (sudo or standard) yields only the commands entered after the upgrade.

What could have happened here?

1 Answer 1

2

In this particular case, I found that the history had gotten into a strange state.

Nothing was present in the .bash_history file, however, there were plenty of saved sessions in the .bash_sessions folder of the user root (e.g. ~).

Once inside the .bash_sessions folder, I found there was a file with a GUID and a .historynew extension.

Ex:

~/.bash_sessions/{GUID}.historynew

That file contained the lost commands, but somehow was no longer attached to the saved history for the user. From there I simply piped the output and appended to the .bash_history file, and started a new session and everything was back. One way to do this:

cat {GUID}.historynew >> ../.bash_history

You must log in to answer this question.

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