How to prevent clearing of terminal output when I "exit" an SSH session?

Check ~/.bash_logout

It probably contains a clear command. Comment that out.

Also, in a lot of terminals, (e.g. gnometerm) you can just scroll back up and see what was "cleared".


You stated Ubuntu, but for the sake of others, if it is a recent updated cygwin, edit /etc/bash.bash_logout and comment out the following:

if [ "$SHLVL" = 1 ]; then
    [ -x /usr/bin/clear ] && /usr/bin/clear
fi

Future updates will not overwrite the file if it is modified.