Tips to Get Started with Screen, the Terminal Multiplexer

The more you feel comfortable with terminal, the higher the number of terminals that will be open. For sure you will many things to keep a tab, one for your email, one for the code, one for executing the code, and so on. And one might easily get annoyed, rightly so, recreating your multiple sessions as you move from one place to another.

Imagine there is a magical world, where you work on over dozen terminals and get to go to a place that is far apart, but still could access the same 12 terminals and the associated shells, commands. That can’t be real right? No, thats what the magical program “Screen” brings to you on your Linux terminal.

Screen is a terminal multiplexer that allows you to run multiple command shells from a single terminal. With screen, you can say good bye to multiple terminal tabs and cluttering your window with multiple terminals. On Linux and Mac OS X machines, Screen is already installed these days. So why wait, get started with Screen. Here are some tips to get started with Screen and be on the way to become a pro user.

How to Launch Screen on your Terminal?

To get started with Screen, just type “screen” on your terminal. Since you will be opening multiple sessions from a single terminal, it is good practice to assign a name when you start a screen session. So, instead of just typing “screen” on terminal, type

screen -S sessionName

to initiate screen session with the title that you give.

How to create a new session/window?

To create a new screen terminal or session, type

[Control] [a] –

where “c” means create a terminal. To see the power of screen, just close the terminal program after initiating the screen and opening mor ethan one sessions. Yes just close the terminal application. By doing this you have essentially “detached” your sessions. Start the terminal again and type

screen -R

Now magically you will be able to acces the two screen sessions where left off.

How to list all the windows you have opened using Screen?

If you want to see all the windows that you have opened using Scree, type [Control] [a] [Control] [w]. It will list the windows with assigned names starting from 0.

How to assign a title to a current window in Screen?

[Control]-[a] [A] allows users to assign a title to the window.

How to Move between Windows in Screen?

There are a number of ways to move between windows in Screen. Check above to learn more the windows you have opened using Screen. To go to the first window that you opened in Screen , type

[Control] [a] [0]

To change to the second window you opened, Type [Control] [a] [2]. You can use similar commands to go up to 9th window. Another easier way to do is use the command
[Control][a] [w] and see all the windows you have opened. then you can scroll to choose the window that you want to go to. To go to previous window, type [Control][a] [Control][p].

To go to next window, type [Control][a] [Control][n].

How to Close all Windows opened by screen?

The command to kill all the windows opened by Screen and terminate the Screen application is to type

[Control] [a] [Control] [\]