Jay Taylor's notes

back to listing index

In ~/.screenrc: altscreen on enables alternate screen, which is disabled b... | Hacker News

[web search]
Original source (news.ycombinator.com)
Tags: configuration screen news.ycombinator.com
Clipped on: 2018-01-26

In ~/.screenrc: altscreen on enables alternate screen, which is disabled b...

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.
Image (Asset 1/1) alt= Applications are open for YC Summer 2018
Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: