5 ms·
Your shell is likely configured to write to the file, instead of appending to it. shopt -s histappend In your .bashrc should do. To have it write after ev
by tokenizerrr 11y ago
Your shell is likely configured to write to the file, instead of appending to it.
shopt -s histappend
In your .bashrc should do. To have it write after every command take a look at http://unix.stackexchange.com/a/1292 http://unix.stackexchange.com/a/1292
- gknoy 11y agoSome people dislike it, but I LOVE it. I like being able to run a command, open a new terminal, and be able to control-r to find that command again. It ensures that I don't have race conditions over which terminal writes its history to disk first, as well, so I lost far fewer (zero?) history elements.
- JdeBP 11y agoYou've conflated terminal and shell there. It's an important distinction because, in fact, there's still one race condition with history files, even if you only have /one/ shell running. It's down to the Bourne Again shell not doing atomic updates when it rewrites the history file. It's one of two bugs, the other being systemd sending multiple signals in very quick succession to kill a terminal login session, that in combination cause the effect discussed at https://news.ycombinator.com/item?id=10151861 https://news.ycombinator.com/item?id=10151861 . Far from losing zero or a few history elements, it can in fact result in your losing all of your history.