Folks,
Something very strange happened with the Mac OS X Mojave terminal, when I logout or type exit or command + d, the following message appears:
$ logout
Saving session ...
... copying shared history ...
... saving history ... truncating history files ...
... completed.
[Process completed]
Apparently everything is OK, but when I go back to the terminal I see that I lost all the history, it was not recorded. I made cat in .bash_history and the file is empty.
I searched on several sites, but found no solution, because nobody knows what happened.
Then I decided to analyze the files in the home directory as below:
$ ls-flash
total 48
0 drwxr-xr-x + 21 aperture staff 672B Sep 27 21:06.
0 drwxr-xr-x 6 root admin 192B Sep 26 16:53 ..
8 -r -------- 1 amptec staff 7B Sep 27 12:58 .CFUserTextEncoding
24-rw-r-r - @ 1 opening staff 10K Sep 27 20:46 .DS_Store
0 drwx ------ 10 amptec staff 320B Sep 27 20:46 .Trash
0 drwxr-xr-x 14 amptec staff 448B Sep 26 17:48 .atom
8 -rw ------- 1 amptec staff 1.1K Sep 27 20:41 .bash_history
0 drwx ------ 29 amptec staff 928B Sep 27 23:07 .bash_sessions
0 drwx ------ 3 amptec staff 96B Sep 27 20:38 .ssh
. . . . .
I noticed that there is a .bash_sessions directory and I've listed its contents:
$ ls .bash_sessions /
D179694D-70A8-494A-9A65-75499FEFA09C.history
D179694D-70A8-494A-9A65-75499FEFA09C.historyne
D179694D-70A8-494A-9A65-75499FEFA09C.session
D1BF399C-82CF-4DFA-A3DB-864F98AA207C.history
D1BF399C-82CF-4DFA-A3DB-864F98AA207C.historyne
D1BF399C-82CF-4DFA-A3DB-864F98AA207C.session
ED100EAF-1883-4496-AA0B-15ABFD77C3B9.historyne
_expiration_check_timestamp
I made cat in these session file and saw that the executed commands were written to these files, but they were not transferred to .bash_history.
I closed all the terminal windows and closed the terminal with command + q, opened the terminal again and continued with the empty history.
Removed the session files with the following command:
rm -rf .bash_sessions / *
I closed the terminal again.
I reloaded the terminal and did some new tests and everything worked to normal.