Intro to GNU Screen

written by billy March 19, 2010

gnu_mirror

GNU screen is a super handy utility that every linux/unix admin should get familiar with. It creates a virtual terminal that allows you to disconnect at reconnect without ending your session. There really are a ton of options available and I will likely get to those in other posts. For now, this will focus on some of the most basic but very common (at least for me) usage. I access the same linux servers and some desktops from many different computers (Ubuntu desktop, MacBook Pro, Windows XP, Ubuntu laptop, etc.). Using screen allows me to resume working sessions from any one of these picking up right where I left off.

How to start screen
That is really simple, type screen in your xterm or putty session once you log in. This will give you a shiny new shell and you are rocking screen.

How to exit a screen session
Existing is almost as easy as starting it. All screen commands, once screen is running of course, start with the CTRL-A keyboard combination followed by one other character that tells screen what you want to do. So, after CTRL-A press the D key to detach.

How to resume a screen session
The first step to resuming is knowing which screen sessions are out there. To do this run screen with the -ls arguments and a list of active screen sessions will be shown. Resuming the session is a matter of typing screen -r and the desired session name.

How to kill a screen session
When you are sure you will not need a screen session use the k option to kill it as in CTRL-A k

Putting it all together, I’ll show you the process of starting screen, detaching, then resuming a session, and finally killing it.

Leave a Comment