Screen - the terminal window manager
Sunday, June 10, 2007 1:25:09 PM
You can start it by typing:
screen
By default this displays license and then open shell, but you can define it to start up predefined list of programs. At that point it's hard to tell if Screen is running or not. One way to check it is to try to change window. You can do that by pressing control+a and then 0 (which is number of the first window). If Screen is running, it notifies that window 0 is already open.
You can detach the session by pressing control+a and then ctrl+d. To resume the session, you can type:
screen -r
Though if for some reason Screen is already attached you have to use:
screen -dr
If you want to attach session, without detaching already running session, you can also use:
screen -x
Though keep in mind, screen size is always same in all the attached sessions, so if you want to use whole screen (or shrink to see everything type: control+a and F.
To quit and close all windows, type control+a :quit.
I'll end with summary of commands I use most often (you can always read the manual, if you want to see the full list). Line that starts with screen is command line option. Other commands are typed when screen is runnig.
Attaching and detaching session
Start new session: screen
Attach a session: screen -r
Detach and then attach a session: screen -dr
Share session: screen -x
Working with windows
Create new window: control+a c
Change to window number 1:control+a 1
Change to previously open window: control+a control+a
Go to next window: control+a n
Go to previous window: control+a p
Window tiling
Split window:control+a S
Focus next region:control+a tab
Remove region:control+a X
Remove all regions: control+a Q
Monitoring windows
Monitor for activity: control+a M
Monitor for inactivity: control+a _
Working with multiple sessions
List sessions: screen -ls
Resume session: screen -r session_name
Rename session: control+a :sessionname name
Quitting
quit and close all windows permanently: control+a :quit








RamūnasRamunas # Sunday, June 10, 2007 1:37:16 PM
Unregistered user # Monday, September 10, 2007 12:11:41 PM
Antero Hytönenanzah # Monday, September 10, 2007 6:32:44 PM
For example if you want to have 10 characters high top window, you could type this after selecting the top window:
ctrl+a :resize 10
If it looks too small you can add one row with following command:
ctrl+a :resize +1
Good question. I use that feature a lot, but didn't remember it when I was writing the article.
Unregistered user # Sunday, September 23, 2007 6:56:13 PM
Antero Hytönenanzah # Wednesday, September 26, 2007 8:01:20 PM
Usually that happens when you have shared session open. Only one session can control the size and other sessions show the screen exactly the same as it's seen in other sessions. It doesn't matter if everything fits in the terminal or not.
So, if you want to keep the size fixed, you can open shared session with screen -x and press control+a F. After that, the shared session is controlling the size and you can resize that terminal to just the right size and go back using the original session.
Unregistered user # Saturday, October 13, 2007 7:22:30 AM
Unregistered user # Friday, June 19, 2009 12:49:28 AM
Antero Hytönenanzah # Monday, June 22, 2009 11:49:06 AM
#Populate some windows with commands (remember to change prameters to suit your needs)
screen command
title command_title
screen second_command
title second_title
#Do actual splitting
split
focus top
select 0
focus bottom
select 1
mahenmahen21 # Monday, July 13, 2009 6:52:57 PM