Menu

The Quick-N-Dirty Guide to Screen

Screen is a useful application. We’re only going to cover two of its more common uses in this article.

1.) Do you have screen

At a command prompt type

which screen

If you get an answer like /usr/bin/screen or /usr/local/bin/screen go to step three, otherwise go to step two.

2.) Installing screen

See our installation guide for instructions on installing screen in your distribution. It’s a well-known application so almost all distributions have their own version of it.

3.) Using screen

Screen has several uses. My most frequent use of it is when I’m working on something either in X, console or remotely, and may want to change from one to another.

For example, while at home, I log into a server at work. I have something that might take time on the server, but my connection between home and work is problematic. So, I get on through our company’s VPN and log into the server.

Now, I have to copy a very large directory which may take 20 minutes. If my connection gets cut off during that twenty minutes, something may go wrong. However, if I use screen

screen cp SP02 SP02.bak

I can now detach the screen. The default key combination to preface any command to screen is ctrl+A (which will be abbreviated as C-a). So

C-a
d

This will detach the screen. I can now log off. Ten minutes later, I wish to check on its progress so once again I connect and

screen -r

The d and r stand for detach and reattach. If the process is finished, I will get a message that there is no screen to be resumed. Otherwise, it will put me back where I was when I detached the screen.

Another handy use of screen is to make two windows in a console. To do this

C-a
Shift+S

This creates a second window. The cursor is still in the top window

C-a
tab
C-a
c

One tabs to the second window, then does the C-a combination again and c. You will then be able to enter a command. This is far less cumbersome to do than it may seem from reading it.

References
man screen