Screen: Difference between revisions

From Redbrick Wiki
Jump to navigation Jump to search
Line 21: Line 21:
Just hit space/return as it says and you'll be running screen. You won't notice anything immediately different once running screen, instead, you'll be back at the same old terminal. Now, however, you have access to a large variety of commands and features that you didn't before.
Just hit space/return as it says and you'll be running screen. You won't notice anything immediately different once running screen, instead, you'll be back at the same old terminal. Now, however, you have access to a large variety of commands and features that you didn't before.


=== Creating windows ===
== Screen commands ==
When you start screen, it presents you with one default window.
=== Ctrl-a commands ===
  ctrl + a c
Nearly all of screen's commands are used via the ctrl-a key combination. First, you press the ctrl and a keys together, then release. Next, press the key you want to run a command. These commands can be a little awkward and difficult to remember at first, but you'll soon get the hang of it. In this tutorial, the commands will be shown as ctrl-a and then a letter, with the following letter being associated with a command.
This keybinding will open a new window (window 2) inside screen.
 
=== Creating a new window ===
When you start screen, it presents you with the normal single window terminal you're used to. You can, however, create many more and run them all within the one screen session. The following command will create another window for you:
  ctrl-a c
 
Just hit ctrl and a together, then release them and hit c. This keybinding will open a new window (window 2) inside screen. Now you'll have two windows to use, so you'll have to learn how to use the ctrl-a commands to switch between them.


=== Switching windows===
=== Switching windows===

Revision as of 01:25, 6 December 2007

Basics

screen usually does not exist. This is the committee's general position on screen due to the disastrous and/or hilarious situations which often result from new members' attempts to get it working. However, for the purpose of this tutorial, screen does exist, and this is how you use it. (Blame coconut for this defiance.)

Omg, what's screen?

screen is most commonly known as "that thing that lets you stay logged in to chat when you log out of RedBrick". It's a terminal multiplexer, which allows you to log into multiple terminal sessions from one terminal window and keeps them open when you go away to bed or whatever it is you do with your time.

Opening

Type "screen" at the prompt like this:


Screen1.jpg


This will open a new screen session. First you'll see the screen startup message, which gives a little info on the program.


Screen2.jpg


Just hit space/return as it says and you'll be running screen. You won't notice anything immediately different once running screen, instead, you'll be back at the same old terminal. Now, however, you have access to a large variety of commands and features that you didn't before.

Screen commands

Ctrl-a commands

Nearly all of screen's commands are used via the ctrl-a key combination. First, you press the ctrl and a keys together, then release. Next, press the key you want to run a command. These commands can be a little awkward and difficult to remember at first, but you'll soon get the hang of it. In this tutorial, the commands will be shown as ctrl-a and then a letter, with the following letter being associated with a command.

Creating a new window

When you start screen, it presents you with the normal single window terminal you're used to. You can, however, create many more and run them all within the one screen session. The following command will create another window for you:

ctrl-a c

Just hit ctrl and a together, then release them and hit c. This keybinding will open a new window (window 2) inside screen. Now you'll have two windows to use, so you'll have to learn how to use the ctrl-a commands to switch between them.

Switching windows

If you have more than one window open, you can switch between them using.

ctrl + a + a

or using

ctrl + a + window_number

or using

ctrl + a + n
ctrl + a + p

to go forward, or back.

Detaching screen

The beauty of screen is that it can remain running when you are logged out, therefore allowing you to run time consuming processes in the background. Dettach using

ctrl + a + d

Reattaching screen

To reattach an allready detached screen, use.

screen -d -r

The -d will dettach any "attached" screens and -r will reattach your screen.

Note that if you have more than one screen session available, you will need to specify the screen id you wish to open.

Killing screen

Often enough new members (and people like goldfish) will make mistakes with screen. To kill screen altogether and start over

ctrl + a + \

More commands

A long list of screen commands can be found here: http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=s/screen