Hacker News new | past | comments | ask | show | jobs | submit login

In ~/.screenrc:

    altscreen on
enables alternate screen, which is disabled by default, but is normally enabled in most terminals. It's the thing which prevents less, vi, etc. from clobbering the screen contents and leaving their gunk behind after exiting.

(A Google search seems to indicate that some people dislike this feature, but I found screen unusable until I discovered this option.)

Thank you! I have been using screen for 2 years and wanted to know how to fix this, but never knew what phrase to google to see if there was a fix. Every time I would background emacs (^z) it would clobber all of my previous console output so I would have to re-grep things, for example.

In return I give you my favorite screen hack that displays the available RAM on the server every 30 seconds in the caption:

In ~/.screenrc

    backtick 2 30 30 $HOME/.screenrc.bt.2
    caption always "%{gk}plab001 %?%{wk}%-Lw%?%{yK}%n*%f %t%?(%u)%?%?%{wk}%+Lw%? %=%{yk}%2` %{gk}%c %{yk}%d/%M/%Y"
in ~/.screenrc.bt.2

    free -m | xargs | awk '{print $17 "MB"}'
The caption string above also prints the current window titles and the time/date, so this is also useful for keeping ssh sessions open indefinitely since there is activity at least once a minute when the time updates.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact