With screen you can log in to a server and stay virtually logged in even when you shut down your computer. You can also go to another computer, re-login to the server and resume the same terminal session.
Example used is on our ocean.stanford.edu server.
First connect to ocean (ssh email@example.com). After you are logged in type 'screen' (no quotes, it if complains about a terminal or something, set terminal to vt100, by typing 'setenv TERM vt100'). Press space or return to continue. You will then see a '>' prompt. Follow the commands below (comments are preceded by #):
> > source .tcshrc (or .cshrc) # screen doesn't read your 2 login files. you have to > source .login # source both .cshrc and .loginNow you will see you trusty old login shell again.
If you want log out of ocean, or close down your computer, but still keep the terminal session running, you have to detach it. This is different then exiting screen. If you exit screen, by typing exit, you lose that session. To detach it, type Ctrl-a Ctrl-d (most commands in screen start with Ctrl-a, this overrides the Ctrl-a command normally used when you want to jump to the start of a line). To reconnect to it, type 'screen -r'.
- You can have more then one 'window' in one screen session. New window: Ctrl-a Ctrl-c.
- Switch back to the last window you were: Ctrl-a Ctrl-a.
- Switch to the next window: Ctrl-a Ctrl-n
- All windows are numbered. Type Ctrl-a Ctrl-w to see a list. The one with a * is the current one. To switch to eg. window 3, type Ctrl-a 3.
- To delete a window: Ctrl-a Ctrl-k.
- Log the session to a file: Ctrl-a H - Many more commands... see 'man screen'
- You can also have more screen sessions. From another terminal window (not inside screen) type screen again. To see a list of screen session: screen -list. It will also show if they are attached (open somewhere) or detached. You can only reconnect to detached screen sessions. If more then one screen session, type 'screen -r screenname' (where screenname is something like: 4707.pts-14.ocean). If you want to reconnect to a screen that is attached somewhere, you can force it to detach and then reconnect by typing: 'screen -D -r screenname'. Again see the man pages for more options.