8.6.28 Console switching with screen
The screen
program allows you to run multiple virtual terminals,
each with its own interactive shell, on a single physical terminal or terminal
emulation window. Even if you use Linux virtual consoles or multiple
xterm
windows, it is worth exploring screen
for its
rich feature set, which includes
8.6.28.1 Remote access scenario
If you frequently log on to a Linux machine from a remote terminal or using a
VT100 terminal program, screen
will make your life much easier
with the detach feature.
You are logged in via a dialup connection, and are running a complex
screen
session with editors and other programs open in several
windows.
Suddenly you need to leave your terminal, but you don't want to lose your work
by hanging up.
Simply type ^A d to detach the session, then log
out. (Or, even quicker, type ^A DD to have screen
detach and log you out itself.)
When you log on again later, enter the command screen -r, and
screen
will magically reattach all the windows
you had open.
8.6.28.2 Typical screen
commands
Once you start screen
, all keyboard input is sent to your current
window except for the command keystroke, by default ^A. All
screen
commands are entered by typing ^A plus a
single key [plus any parameters]. Useful commands:
^A ? show a help screen (display key bindings)
^A c create a new window and switch to it
^A n go to next window
^A p go to previous window
^A 0 go to window number 0
^A w show a list of windows
^A a send a Ctrl-A to current window as keyboard input
^A h write a hardcopy of current window to file
^A H begin/end logging current window to file
^A ^X lock the terminal (password protected)
^A d detach screen session from the terminal
^A DD detach screen session and log out
This is only a small subset of screen
's commands and features. If
there's something you want screen
to be able to do, chances are it
can! See screen(1)
for details.
8.6.28.3 Backspace and/or Ctrl-H in screen
session
If you find that backspace and/or Ctrl-H do not work properly when you are
running screen
, edit /etc/screenrc
, find the line
reading
bindkey -k kb stuff "\177"
and comment it out (i.e., add "#" as the first character).
8.6.28.4 Equivalent program to screen
for X
Check out xmove
. See xmove(1)
.