29

This is the situation: I open a terminal in Ubuntu, and do ssh host-1, which works as expected. From host-1, I do ssh host-2, which again works fine and connects me to host-2. From host-2 I do, for example, echo "blah", which prints blah to the screen. Problem: If I do exit, the screen is cleared, and I am left with only the following:

Connection to host-2 closed.
myusername$

How can I prevent the clearing of output from the screen generated by commands run on host-2 (i.e. blah, etc.), after I exit back to host-1?

Some debugging I've already done: I've had a friend login to host-1 and host-2, exactly as above, and when he exit's from host-2, his screen is NOT cleared. So it must be something to do with my environment...right? Any ideas what it could be?

I've tried this using PuTTY in Windows XP, and from a terminal in Ubuntu - same behaviour regardless.

2 Answers 2

33

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".

1
  • Yep, it was in ~/.bash_logout. Thanks :)
    – Roy
    Mar 13, 2009 at 21:39
6

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.

You must log in to answer this question.