This is my screenrc - whats yours

by Karanbir Singh Email

Everyone uses screen right ? If not, what's wrong with you crazy person ?

Also everyone at some point or the other realises that its worth getting a decent screenrc in place. So did I, many years back. Essentially the screenrc lets you setup a few things about how you want screen to look and work. A config file, yes. And here is what I currently use:

caption string "%?%F%{= Bk}%? %C%A %D %d-%m-%Y %{= kB} %t%= %?%F%{= Bk}%:%{= wk}%? %n "
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'

You can download it here : http://www.karan.org/stuff/MyScreenRc : remember to move it to ~/.screenrc .

What you see here is the result of what came from many iterations of changes. I remember in 2006 my screenrc put up a 3 line display with everything that anyone would ever need, including load on a machine, number of unread emails, days-for-present-sprint to end etc. And to be honest, while most of that is good to know I think the only things one needs on the console are : hostname, screen windows and labels for those and finally the time. On a nice dull background so its not in your face too much. Which is exactly what my existing screenrc is setup to be.

One interesting thing is that often when pairing with me or when people see my console shell they would ask why bother with the hostname, specially since you should know from the shell prompt what machine you are on. Well, yes - but then that does not work out too well when you start cascading shells between machines. Eg: machine 1 -> machine 2 -> machine 3. It can get tricky, but because I have my status bar setup on each shell - here is what my terminal looks like in that case:

stacked screens

So you can easily see how the screens are stacked up and on what machine with screen windows on each machine. Quite like that.

So do you have a screenrc setup ? tell me about it. If not - then well, this one here should be a good place to start from - and tell me if you like it, hate it or think it can be improved in some way.

- KB

11 comments

Comment from: martijn [Visitor]
# don't display the copyright page
startup_message off
# visable bell
vbell_msg "beep"
# hardstatus
hardstatus alwayslastline "%{rw}%H%{wk}|%{wr}%c%{wk}|%d%M|%?%-Lw%?%{wb}%n*%f%t%?(%u)%?%{wk}%?%+Lw%?"
06/Jan/2010 @ 13:07
Comment from: Matt Simmons [Visitor] Email · http://www.standalone-sysadmin.com
Hey, nice! I haven't used a screenrc before, but I put the one you provided in place, and love it. Since I'm admining a decent number of servers, I might take a look at the docs and throw a couple more things in there, but you're right. It's a great start. Thanks!
06/Jan/2010 @ 13:13
Comment from: brian [Visitor] · http://directedge.us
Here's mine. I did not make this from scratch. I think I found parts of it in the FAQ or mailing list, the modified it:

# Change scrollback to 10000 lines
defscrollback 10000

# status line at the bottom
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%f%n %t%{-}%+w %=%{..G}[%H %l] %{..Y} %m/%d %c "

http://directedge.us/content/screenrc-file

-orev
06/Jan/2010 @ 14:04
Comment from: Jason [Visitor] · http://jprice.org
termcapinfo xterm ti@:te@

Fix the one real annoyance with screen... that scrollback in Putty doesn't work.
06/Jan/2010 @ 14:58
Comment from: Martin [Visitor]
Here is mine you can
shell bash
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%3= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'

activity "%C -> %n%f %t activity!"
bell "%C -> %n%f %t bell!~"
pow_detach_msg "BYE"
vbell_msg " *beep* "
bind .
bind ^\
bind \\
bind ^s
bind G screen -t 'Google' links www.google.com
bind K
bind p paste .
bind V screen -t 'vim' 1 vim
bind X lockscreen
bindkey -k kP copy
bindkey -k k7 prev
bindkey -k k8 next
nonblock 1
defnonblock 1
06/Jan/2010 @ 16:19
Comment from: RevRagnarok [Visitor] · http://blog.revragnarok.com
I don't remember where I got it from...

hardstatus on
hardstatus alwayslastline
hardstaus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
vbell off
06/Jan/2010 @ 18:41
Comment from: Alex Tang [Visitor]
I've just got a simple one:

defscrollback 100000
# remove "feature?" on redhat machines where status line appears in title of window.
tercapinfo xterm hs@
06/Jan/2010 @ 23:32
Comment from: Viktor [Visitor] · http://www.motd.hu
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
# Default screens
screen -t shell1 0 alsamixer
screen -t shell2 1 ncmpc
09/Jan/2010 @ 12:20
Comment from: Stephen [Visitor]
Before spending a lot of time tweaking your .screenrc, take a look at the byobu project [1]. When I first saw it, I was just about speechless.

[1] https://launchpad.net/byobu
15/Jan/2010 @ 21:59
Comment from: Craig [Visitor]
defscrollback 10000
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
18/Feb/2010 @ 12:04
Comment from: Andy Millar [Visitor] · https://www.andymillar.co.uk/
hardstatus alwayslastline
hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %d/%m/%y %c ]%{W}'
nonblock on

:-)
24/Feb/2010 @ 12:43

This post has 3 feedbacks awaiting moderation...

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)