
What is Screen?
Screen is a full-screen window manager that multiplexes a physical terminal between several processes.
What the heck does that mean? Well it means that you are running a virtual terminal as a process. This allows you to do all sorts of neat things, from disconnecting and resuming the terminal where you left off, to mirroring the screen so students can watch your session, to split terminal screens. Screen is one of those tools that most system admins simply can’t live without.
Installing Screen
For Debian/Ubuntu based systems running Firefox you can install screen by clicking here. Otherwise use your package manager:
You might have screen already installed on your distribution. Type, ‘which screen‘ to find out.
What is it good for?
Leaving the Terminal
Probably the most common use for screen is attaching and detaching screen on a remote system. Let me explain. So you are doing some work on a system and you need to upgrade a few apps. A few minutes go by and you realize you have to leave. You need to know when the process finishes or if it even finishes at all. If you were to log into the machine from a different computer you would be able to tell if the task was still running by checking the running processes but you wouldn’t know if it finished OK, or if it needs user input since the SSH terminal is open to the original computer only. Screen can be setup to allow you to detach your session and resume it by connecting to another computer eliminating the problem that was just described which screen.
To do this start up screen with:
Then do your task when you are ready to detach the console do:
Now when you are ready to resume work you can use:
Your session should restore exactly how you left it.
Split Windows
Using screen to have split console screens is another use for screen. This allows for some neat things. Programmers often use this so they can have their text editor open and a shell open below it to execute the program they are working with. This is especially useful for scripting languages like Perl or Python. You could also use a split screen to open a man page of the program you are working on.
Split the screen with:
Create a new window with:
You can resize with:
Switch windows wtih:

Kill a window with:
Pair Programming
A less common approach to using screen is utilizing the multiuser mode to do pair programming or create a teaching environment.
Turn multiuser mode on:
Add permissions for user (change user to the username you want to allow screen access):
Now instruct the second user to connect to the screen with:
Now the session is shared and both programmers can type into the terminal.
Further reading
Was this information useful?
10 Responses
-
It might be useful to know how to kill your extra window in part two.
-
Mark Sanborn
4-13-2009
Oh yea good call, thanks Ross I’ll add that to the article.
-
Greg
4-13-2009
I use tmux (tmux.sf.net) nowadays.
It has almost the features of screen i use, its much more lightweight, with a clear code base, and BSD licensed. -
Matthew
4-13-2009
I recently discovered INX (http://inx.maincontent.net/). This is an Ubuntu-based live CD that lacks an X server and is set up as a learning tool about the command line. It includes comprehensive coverage of GNU Screen, and is a good tool for newbies to play with – you’re never left at a blank screen, it’s all menu driven, and the coverage on Screen is pretty good.
-
> Your session should restore exactly how
> you left it.
Well, sort of; a detached screen doesn’t ‘pause’ any running task, so using Screen is nice to start a process and then detach it, and come back to it later once it’s done running. -
nice tutorial Thx for sharing nfo
-
[...] Screen Quick Reference – Quick reference to a must have screen emulator, Also check out Introduction to GNU Screen [...]
-
hi, nice article.
additionally, you can write, how to copy/past with
ctrl-a esc # copy mode
arrow keys # move to text
space # begin marking
arrow keys # marking
space # end marking
ctrl-a ctrl-a # jump to another screen
ctrl-a ] # past -
[...] Introduction to GNU Screen (tags: screen linux admin) [...]
-
[...] Introduction to GNU Screen (tags: systems gnu intro introduction screen interesting howto admin linux sysadmin unix server share administration hack remote sharing tool network) Comments (0) [...]




4-13-2009