Screen is a useful application. We're only going to cover some of its more common uses in this article.
If you get an answer like /usr/bin/screen or /usr/local/bin/screen go to step three, otherwise go to step two.
First, start the screen program by typing
There will be a little note about it, with instructions to hit the space bar or return to continue.
So, let's say that I want to check email with mutt in console and also wish to untar something that I downloaded. First, I type mutt to open my email. Now, I want to untar the download.
By default the prefix to screen commands is Ctrl+a, hereafter abbreviated C-a. So, I start with that.
The second c will bring me to a command prompt. I can move back and forth between the two screens with C-a n (for next) and C-a p (for previous).
The usefulness of this is more apparent with a remote login. Now you can do several things with one remote terminal.
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.
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
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
This creates a second window. The cursor is still in the top window
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.If you wish to go back to one window, I've found the easiest thing to do is exit (by, oddly enough, typing exit) from one window. Then, detach the screen with C-a d. Now, reattach it with screen -r and you should be back to only one window.