multiple workspace on single terminal with screen

October 5th, 2006 mysurface Posted in Misc, screen | Hits: 24627 | 3 Comments »

Screen is a useful tool, it allows you to have multiple workspace on a single terminal. Linux usually support 5 virtual terminal, where you can press CTRL+ALT F1 til F5. And you can open multiple gnome-terminal or xterm at a GUI session, even gnome-terminal support tabs, which group all terms together. But why screen? screen makes multiple shell sessions (multiple screen terminals) on a single terminal. You will realized the benefits if you often access through SSH.

I found the learning curve of screen is steep, I ll try to make the example as easy as possible.

To initiate screen, just do

screen

You can close your terminal by click on close button, you screen session will be remain. Therefore you should check whether any screen session pending.

screen -ls

To resume the previous session, do

screen -R

Okay now we are in the screen environment. Bare in mind you have a lots of CTRL and SHIFT to press. The first important command key to remember is Ctrl a, i am going to write it as C-a.

To check for more help options:

C-a ?

To detach the screen and get back to real shell, so u can resume later.

C-a d

To exit from a screen, just type

exit

But sometimes you have multiple screen terminals, in order to close it all.

C-a :quit

PS, C-a d, means press Control with a, then press d separately. You can actually continue holding ur control key and press d, it works for me. It becomes C-a C-d.

Bellow shows the command keys for manipulate multiple screen terminals :

Command

Description

C-a c

create a new screen terminal

 C-a "

show a list of screen terminals

 C-a n

switch to next screen terminals

 C-a p

switch to previous screen terminals

 C-a C-a

switching within 2 screen terminals

C-a A

change the current screen terminal’s name

You can create a tab views for screen, I found relying on C-a ” to switch terminals difficult. You can create a rc file at your home directory, its call .screenrc

hardstatus alwayslastline
hardstatus string '%{= kB}%-Lw%{+r}%50> %n%f* %t%{= kB}%+Lw%< %{= kB}%-= %{-}'
startup_message off

I make my tab views stay at the last line. The strings indicate the colors and the string to display. You can change it, refers to man screen. Remember, screen have to restart to take changes effect. At the last line I just disable the startup message.

For more details tips can refers to TIP Using screen from gentoo wiki.

3 Responses to “multiple workspace on single terminal with screen”

  1. I just discover that, I couldn’t scroll my screen. To do that, I have to get into copy mode.

    C-a [ESC]

    You can scroll now, to exit copy mode

    [ESC]
  2. [...] rTorrent session can also be multiplexed with the additional use of GNU screen utility, which enables you to do some other work while while monitoring your downloads. [...]

  3. felix angelo Says:

    please email me.. we have a programming assignment in shell scripting that requires us to divide the monitor into two workspaces..

    when i click the mouse into the left workspace, it will be active.. while if i click the mouse on the right workspace, it will be active.

    please help me

Leave a Reply