For RedHat flavor of Linux (Feodra, CentOS, AlamaLinux, Rocky, etc), I frequently open a connection to a remote server and open screen software. This retains the last bash command and output from the previous connection.
One odd thing I have noticed, if the server is rebooted (or power loss) without me closing screen sessions. Bash (running under screen) doesn’t retain the command history of the previous commands in this case
Normally bash only does a ‘save current command history’ to .bash_history at clean exit/close of the bash session. However, I can force this action with a manual ‘history -a’.
Is there a method for screen or bash to auto save command history periodically?