Open douglasheld2 opened 3 weeks ago
This is because it appears the file ~/.bash_history
is not updated until Terminal is closed normally. If you reboot without closing Terminal then the process is just killed and does not perform the normal closing down actions. This applies to a number of apps that do not save their state on the fly.
A quick look at the code indicates this is a feature of the bash shell not of the Terminal app. Terminal only deals with the history of closed tabs (which is not persisted) and the state of open tabs (which is only persisted if the app is closed down normally).
There is a related issue open here: https://github.com/elementary/gala/issues/537
I'll look into the possibility of making the shell write that file after each command.
A possible workaround is detailed here: https://askubuntu.com/questions/67283/is-it-possible-to-make-writing-to-bash-history-immediate
I can confirm that commands into second and subsequent tabs may not be properly saved to .bash_history
probably because they have separate bash processes that store different histories for each tab so there is a possibility of them competing to update the history I guess. Not sure what can be done about that. I guess if the history were updated on the fly it would fix it as it is only possible to enter one command at a time.
The issue here looks like the same from #616, Terminal doesn't close the shell processes if the system is shutdown with it open.
a possible solution here would be registering with the session and exiting all the child processes so the shell get a chance of writing to the history file.
I can confirm that commands into second and subsequent tabs may not be properly saved to
.bash_history
probably because they have separate bash processes that store different histories for each tab so there is a possibility of them competing to update the history I guess. Not sure what can be done about that.
last closed tab keeps the history. what could be done by terminal is keep a list of open processes in less recently interacted order just for closing purposes.
What Happened?
My Terminal bash history is patchy. I can understand when using multiple tabs, history can get mangled so I've started using a single tab. However, just after reboot I can't find the most recent command I ran and have to Google it again.
Steps to Reproduce
Steps to reproduce:
foo
bar
history
Expected results: output includes "foo" and then "bar"
Actual results: output "foo"
Expected Behavior
When Terminal catches signal from system reboot, it should allow bash shell to save the session history. Terminal should be trapping all necessary signals, including whichever signal is sent from
sudo reboot
OS Version
7.x (Horus)
Software Version
Latest release (I have run all updates)
Log Output
Hardware Info
MacbookPro7,1, 16GB RAM bcmwl-kernel-sources driver is installed