// you’re reading...

Linux, Unix, and Solaris

Using screen in the Linux shell

Have you ever been remotely connected to a host using SSH and thought to yourself: “self, I wish I had more than one window…” So naturally, you opened an additional SSH session. This is fine, but then you need to organize desktop windows when there’s a much simpler solution:
Use the screen shell program. Screen allows you to open multiple virtual shell sessions and run different programs in each, as well as some other, more advanced awesomness.

Here’s a quick start.

1. SSH into your remote box.
2. See if it has screen by typing:


If you see a new clear screen, it worked, otherwise you’ll get something like: “-bash: screen: command not found” and you’ll need to install screen. Otherwise bail out of screen for now:


3. Edit a new file in your home directory called “.screenrc” paste the preferences below, then save.

defscrollback 5000
hardstatus on
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}[ %m/%d %c ]%{W}'

4. Now type screen again.
5. Finally, here’s the power. Create a second window. Type:

[cntrl]+a c

Cool, eh?

Here’s some shortcuts and advanced options for screen.


2 comments for “Using screen in the Linux shell”

  1. You could try tmux. I like it a lot better than screen.

    Posted by Greg | June 6, 2012, 12:12 am
  2. Why do you like tmux better?

    Posted by Randy | June 6, 2012, 12:40 pm

Post a comment

Help support my site and buy a domain name at http://domainsemailhosting.com/

%d bloggers like this: