Skip navigation.

exploreopera

| Help

Sign up | Help

Missing pieces

Everything you should know about technology, but have been missing out

Screen - the terminal window manager

, , ,

Imagine tiling window manager(with only horizontal tiles) and session management like VNC, but for terminal. You'll get program that can manage number of terminal sessions and keeps them running even after you log out. That makes it popular among people who have remote shell account and run IRC client there. Though most people know only about fraction of the useful features it has. It's available for most Unix-like operating systems out there. Some Linux distributions might have installed by default.

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

Managing windowsTagged: 5 things I'd like to see in Opera

Comments

avatar
screen + irssi = IRC FTW!

By Ramunas, # 10. June 2007, 13:37:16

avatar
toto writes:


i know im late

question to Window tiling

any ideas how i can resize the windows with screen like a small top window
displaying some important information and below a bigger one to work with

regards,
toto

By anonymous user, # 10. September 2007, 12:11:41

avatar
Use resize command.

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.

By anzah, # 10. September 2007, 18:32:44

avatar
Anonymous writes:

How can we disable the resizing behavior of screen? I'm finding this really annoying - I just have to stretch the iTerm window to fit again, but there must be some way to change this in screen.

By anonymous user, # 23. September 2007, 18:56:13

avatar
Normally Screen should resize itself when terminal is resized. If it doesn't, you can press control+a F

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.

By anzah, # 26. September 2007, 20:01:20

avatar
Anonymous writes:

good

By anonymous user, # 13. October 2007, 07:22:30

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

Please type this security code : 674a0e

Smilies

July 2008
MTWTFSS
June 2008August 2008
123456
78910111213
14151617181920
21222324252627
28293031