GNU Screen – Terminal Multiplexer
This programs continue to run when their window is currently not visible and even when the whole terminal is closed .
The multiplexing means that you can have multiple programs running within a single screen session, each within its own window.
You can display multiple windows at once, or just switch between them, even if you only have a single terminal window to use.
Using it, you can run any number of console-based applications like command shells, text editors, etc. within a single terminal.
If you are an Ubuntu user , you need install the Screen package.
I used to start a several terminal emulators when I logged into my machine: I wanted one for emacs , one for working with files, one for a shell into my web host, one for ssh and so on. Now I start one terminal emulator, and run screen in it. Problem solved.
- Start screen just by typing screen at your favorite command shell prompt.
You’ll be greeted by a welcome message. Dismiss this and you’ll have with an empty terminal containing a shell prompt, which is the same before you started screen. What happened?
Every program running under screen runs in a window, and every window is identified by a unique number.
Screen made a new window, numbered it 0, and started a command shell inside it.
Type something or execute a comand line program in your new window so you’ll be able to recognize it when you switch to it later.
- Now make another window; this will be window 1.
To do this, type Ctrl-a and then type c
Use C-a n and C-a p to switch to the next or previous window in the list, by number.
Use C-a N, where N is a number from 0 to 9, to switch to the corresponding window.
Use C-a " to get a full-screen list of windows. You can navigate this list with the arrow keys , and pick a window to activate by pressing Enter when it's highlighted.
C-a w will give you a small, non-interactive list of windows.
Try this: just close all terminal emulator you were using before to test screen.
Then log out, and log back in.
Start up a new terminal emulator, and type screen -r . You’ll be right back where you were when you detached.
To split your windows , use C – a S
To switch to the next windows use C a TAB
Then select with C a Number , which terminal bring back.
Exit from screen (?)
Close each of your screen windows. Exit whatever programs or shells each is running, and they will go away. When the last program running inside screen is exited, screen itself will go away.
Screen is a very usefull tool. Even if you work with SSH sessions, you will keep your session open.
Screen does much, much more than I’ve described above, but it’s enough to get you started. You can type C-a ? for a full list of commands available while you’re in screen. The screen man page has a lot of info, too.