Instructor: Ding Yuan
Course Number: ECE344

Home
Discussion (piazza)
Lab Documentation
Lab Assignments
Schedule and Lecture Notes
Grades (UofT portal)

Operating Systems

ECE344, Winter 2015
University of Toronto


Using Screen for Managing Multiple Terminal Windows

The screen program allows you to multiplex a physical terminal into one or more interactive shells. This program is especially useful for remotely accessing the lab machines. Using the screen program, you can start multiple shells on a lab machine from a single PUTTY or xterm terminal. This is especially beneficial for debugging OS161 because you need two windows, one for running the simulator, and the other for the debugger.

A second benefit of screen is that upon hangup (e.g., if your PUTTY session is killed accidentally), it saves all your running programs until they are resumed with the screen -dr command.

To start using screen, add the following into your ~/.screenrc. The first command allows scrolling back a large number of lines. The second command sets up Ctrl-z as the screen escape character that allows you to issue screen commands. The default default screen escape character is Ctrl-a, but that can interfere with line editing commands. If you want to suspend a process, use Ctrl-z a, instead of the default Ctrl-z.

defscrollback 10000
escape ^za

Start screen by issuing the screen command. If you want to start another screen window, type Ctrl-z c, which creates a new window. You can see all the windows, by typing Ctrl-z ”. You can switch between windows by typing Ctrl-z n or Ctrl-z p. You can finish or kill a screen session by typing Ctrl-D.

Say you wish to stop working on OS161 (it is 4 am). You can detach from screen by typing Ctrl-z d. This stops screen but keeps your programs running.

You can log out of the lab machine. Later, you can log back in. To resume screen, type screen -dr. You should see all your screen windows in the state you left them in when you detached from screen.

Screen has a lot of features. You can get help by typing Ctrl-z ?, or you can read its manual page by running man screen.