Difference between revisions of "Screen - Virtual Terminals From Console"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m
Line 45: Line 45:
 
::: '''K'''   kill a screen virtual console
 
::: '''K'''   kill a screen virtual console
 
::: '''<nowiki>\</nowiki>''' &nbsp; kill all screen virtual consoles
 
::: '''<nowiki>\</nowiki>''' &nbsp; kill all screen virtual consoles
 +
::: '''D''' &nbsp; Manually detach from session (same as disconnecting while screen is running)
  
 +
<big>'''Screen Sessions'''</big>
 +
 +
This is the real beauty of screen.  You are working within your virtual console, very busy, and your terminal session is lost, disconnected!  With screen you can log back into the remote system and pick up where you left off!
 +
 +
Starting 'screen' without command line arguments starts a new screen session.
 +
 +
screen
 +
 +
After reconnecting to your shell, you can find and control existing sessions
 +
 +
  screen -ls
 +
* lists currently running sessions
 +
 +
  screen -r sessionname
 +
* attatch to a specific session by name
 +
 +
  screen -x -r sessionname
 +
* attatch to a specific session by name again allowing multiple attachments to a session
 +
 +
  screen -R
 +
* reattach if it can, or start a new session.   
 +
 +
  screen -D -RR
 +
* detach defunct client and attach current to first available session
  
  

Revision as of 00:20, 25 January 2008

screen

screen [options] [command [args] ] 

In their words: Provide ANSI/VT100 terminal emulation, making it possible to run multiple full-screen pseudo-terminals from one real terminal, and letting you manipulate and save your screen input and output, copy and paste between windows, etc.

In other words: multiple virtual terminals from one terminal (like a remote shell), with the ability to detach processes and leave them running even when you disconnect!

  • Do more from one terminal connection
  • Leave stuff running even if you detach or disconnect
  • Handy for unreliable terminal connections
  • Scroll back and see what you missed

Screen offers the ability to detach from a session and then attach to it at a later time. When detached from a session, the processes screen is managing continue to run. You can then re-attach to the session at a later time, and your terminals are still there, the way you left them.

Screen also maintains individual, searchable scrollback buffers for each of the windows it manages. Screen sends all entered text to the current window, with the exception of the command character. The default command character is Ctrl-A. .screenrc is the per-user configuration file in your home directory, and /etc/screenrc is the system-wide configuration file that applies to all users.

Screen sets TERM to screen—each screen window provides its own vt100-compatible virtual terminal. The variable WINDOW is set to the virtual window number, and the variable STY is set to your session name.

Using Screen Walk Through

1. Telnet or SSH into a remote Linux system with screen installed.

2. Type 'screen' in the shell and press enter.

3. CTRL-A + C will open a new screen virtual console.

Say you had 'top' running in the first console, you can press CTRL-A and top will remain running in console 1, it will not be a stopped job, nor will it be 'background' it will in fact remain a fully interactive running process. It is just like you opened a second connection with the remote system.

4. CTRL-A + P will return you to the previous virtual console which is running the top command.

5. CTRL-A + N will put you into the second virtual console

P for previous, N for next.

Basic Screen Commands

CTRL-A +

N   next console
P   previous console
M   monitor for activity
_   monitor for inactivity (default 30 sec)
"   list of open screen consoles, use the J and K keys to navigate
Shft A   manually set screen names (label them)
K   kill a screen virtual console
\   kill all screen virtual consoles
D   Manually detach from session (same as disconnecting while screen is running)

Screen Sessions

This is the real beauty of screen. You are working within your virtual console, very busy, and your terminal session is lost, disconnected! With screen you can log back into the remote system and pick up where you left off!

Starting 'screen' without command line arguments starts a new screen session.

screen

After reconnecting to your shell, you can find and control existing sessions

 screen -ls
  • lists currently running sessions
 screen -r sessionname
  • attatch to a specific session by name
 screen -x -r sessionname
  • attatch to a specific session by name again allowing multiple attachments to a session
 screen -R
  • reattach if it can, or start a new session.
 screen -D -RR
  • detach defunct client and attach current to first available session