Muto - Blog - Feed

Screen is the Best

I'm a busy person and I need to get things done, and I get things done with Screen. Screen basically lets you open new terminals from within the same terminal window, and switch back and forth between them (which is VERY useful for Unix users, since our display servers die every other update). I've been using Screen for a long time and I wanted to write a bit about it!

screen should be available from your package manager, if it's not installed by default on your system. By default Ctrl+a is the command key, which is bad, really bad. I set my command key to F10 because very few CLI programs use F10.

Being Cool with Screen

This is my complete ~/.screenrc file:

# Some generic stuff:
startup_message off
escape \377\377
bindkey ^[[21~ command
set scrollback 10000
bind o colon

# Workspace management
bind a windowlist
bind g screen //group
bind G layout new
bind N layout next
bind P layout prev

# And a shortcut to start Emacs
bind e screen emacsclient -a "" -t

I disable the splash screen, set my command key to F10, set how far Screen can scroll to 10,000 lines, and bind some shortcuts for handy functions. I also made a shortcut for starting up Emacs.


You know how you sort your files into folders? Well, wouldn't it be neat if you could sort your workspaces into folders? Well you can with Screen!

You can use the colon command :screen //group to add a new group to your session. You should see your empty group. I like to rename my new groups with A

(Note that when I refer to commands, I mean you need to press the command key, which is Ctrl+a by default, or F10 for me, then input your command.


Okay check this out. Start a "layout" with: :layout new

Now you should see that you're looking at a new blank Screen window. You can split your window horizontally with |, or vertically with S. Then you can use the TAB command to switch back and forth between the splits (you can remove a split with X).

Now start a NEW layout (again with :layout new) and start a program in fullscreen mode. Now you can switch between your layouts with :layout next and :layout prev!

That's handy, but there's one last tiny little trick that I love…

Layouts + Groups!!!

This just makes everything really clean. Make a new layout, then make a new group. Name the group something like "GROUP1" and populate it with programs.

Then make a new layout, and a new group named "GROUP2". Then populate GROUP2 with other programs. Now when you check your windowlist, you'll only see the programs in GROUP2, but when you switch your layout and check your windowlist, you'll only see programs in GROUP1!

That's just, well it's clean! I'm just rambling about this because I think Screen is pretty much the best thing in the world (tmux is cool, too. tmux is pretty much just like Screen, but with a status bar and some colors. Stuff that's pretty cool if you're into it!) Anyway, have a great day, and stay safe!