In my ubuntu, I constantly use the Terminal multiplexer Screen. He copes with his functions excellently, but he has one puncture - this is the history of commands. An incomprehensible hell is happening to her, so what, but I cannot find my commands there. Can someone tell me how to make the command history work as it should?
1. Add, not overwrite
shopt -s histappend
2. Store multiline commands in one line (optional):
shopt -s cmdhist
3. After each command, reset the history and read the general history (this is if you want commands from one bash to start appearing in the other).
export PROMPT_COMMAND = 'history -a; history -n '
4. Cosmetics: do not memorize command repetitions, do not save specified commands
export HISTCONTROL = "ignoredups"
export HISTIGNORE = "ls: l: ll: [bf] g: exit"
But you always use the screen? Try, for example, to search cat .bash_history | grep aptitude and compare with the memory that you installed.
setopt share_history # share history between multiple instances
then the story will be shared between different windows.
As it will have, if 1-3 sessions are exit, and if more then Ctrl + D many times, but sometimes, of course, it happens that just reboot. It does not seem to affect the result (don't understand how).
Screen is nothing to do with it. History is written by bash, but only if it is completed correctly. - mark brown