LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Blogs > linux-related notes
User Name
Password

Notices


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Apparently there's some "race condition" that can wipe-out bash history if you break some kinds of loops

Posted 07-10-2019 at 01:18 PM by the dsc
Updated 07-10-2019 at 01:20 PM by the dsc

At least that's what apparently happened to me.
On Unix' stack exchange I've found this handy way of recovering it, partly at least, if you happen to have another terminal open, from before the wipe-out:

Code:
history | cut -c 8- > histback_user1.txt
The person who gave this tip suggested doing it in "every terminal", but I believe it would just overwrite it completely for whatever number of times one did it, with the simple ">." In order to not do that and recover some small differences/"ramifications" at the end of the history of each terminal, I guess one would have to do something like that, for one of them, but tweak a bit for the next ones:

Code:
history | cut -c 8- | tail -n [reasonable number] >> histback_user1.txt
For every open terminal, after doing the first command. If these new commands are really that important. Be sure to have ">>" rather than just ">."

https://unix.stackexchange.com/quest.../451016#451016
Posted in Uncategorized
Views 257 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 10:05 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration