Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells.
TL;DR – Screen keeps your ssh sessions alive on a host.
Most servers have
screen installed already. If they don’t it can be installed
apt-get install screen,
yum install screen,
brew install screen. Sorry
Windows, try Remote Desktop.
Get a terminal on a remote host (or local) then run
If you’re not brave, try
man screen to read more about.
screen has started, you’ll want to remember
<C-a>?. That is how you get
the screen options menu. It’s typed literal hold
CTRL and press
a. To quit
screen app, type
exit. To keep
screen running, type
<C-a>d to detach
from the program. To reattach to that session try
There are tons of options and they’re best found by reading the
man page or
gnu screen shortcuts. Here’s some of my favorites.
screen -DDR. Force others of the current session and reattach yourself.
screen -x. Reattach yourself, but allow others to stay in. This is cooperative mode. Good for pairing and much faster than GUI screen sharing.
<C-a><C-c>. Create a “tab” to have multiple sessions.
<C-a><C-a>. Toggle to previous session.
<C-a><Space>. Switch next session.
<C-a>a. Send a literal
<C-a>back to shell.
Config File and Pretty Colors
It’s easy to get lost in screen without a status line. So creating this file in your home directory will help.
This should give you a pretty statusline at the bottom of your terminal. Here’s what it looks like:
A strong competitor to
tmux. It has a more modern code base and is
actively maintained. The reason I personally don’t use it is out of habit and
it’s not installed everywhere.
screen just works for my work flow.