Go to the previous, next section.
For those confined to a hardware terminal, these commands provide a cutand paste facility more powerful than those provided by most windowingsystems.
Copying
Command: copy(C-a [, C-a C-[, C-a ESC)
Enter copy/scrollback mode. This allows you to copy text from thecurrent window and its history into the paste buffer. In this mode avi
-like full screen editor is active, with controls asoutlined below.
CR/LF
Command: crlf [state](none)
This affects the copying of text regions with the C-a [ command.If it is set to `on', lines will be separated by the two charactersequence `CR'/`LF'. Otherwise only `LF' is used.crlf
is off by default.When no parameter is given, the state is toggled.
Scrollback
Command: defscrollback num(none)
Same as the scrollback
command except that the default settingfor new windows is changed. Defaults to 100.
(none)
Set the size of the scrollback buffer for new windows to numlines. The default scrollback is 100 lines. Use C-a i to viewthe current setting.
markkeys
Command: markkeys string(none)
This is a method of changing the keymap used for copy/history mode. Thestring is made up of oldchar=newchar pairs which areseparated by `:'. Example: The command markkeysh=^B:l=^F:$=^E
would set some keys to be more familiar to emacs
users.If your terminal sends characters, that cause you to abort copy mode,then this command may help by binding these characters to do nothing.The no-op character is `' and is used like this: markkeys @=L=H
if you do not want to use the `H' or `L' commands any longer.As shown in this example, multiple keys can be assigned to one functionin a single statement.
Movement Keys
h, j, k, l move the cursor line by line orcolumn by column.
0, ^ and $ move to the leftmost column or to the firstor last non-whitespace character on the line.
H, M and L move the cursor to the leftmost columnof the top, center or bottom line of the window.
+ and - move the cursor to the leftmost column of the nextor previous line.
G moves to the specified absolute line (default: end of buffer). | moves to the specified absolute column.
w, b, e move the cursor word by word. C-u and C-d scroll the display up/down by the specifiedamount of lines while preserving the cursor position. (Default: halfscreenfull).
C-b and C-f move the cursor up/down a full screen.
g moves to the beginning of the buffer.
% jumps to the specified percentage of the buffer.
Note that Emacs-style movement keys can be specified by a .screenrccommand. (markkeys "h=^B:l=^F:$=^E"
) There is no simple method fora full emacs-style keymap, however, as this involves multi-character codes.
Marking
The copy range is specified by setting two marks. The text between thesemarks will be highlighted. Press space to set the first or secondmark respectively.
Y and y can be used to mark one whole line or to mark from start of line.
W marks exactly one word.
Repeat Count
Any command in copy mode can be prefixed with a number (by pressingdigits 0...9) which is taken as a repeat count. Example:C-a C-[ H 10 j 5 Y will copy lines 11 to 15 into the paste buffer.
Searching
/ vi
-like search forward.
? vi
-like search backward.
C-a s emacs
style incremental search forward.
C-r emacs
style reverse i-search.
Specials
There are, however, some keys that act differently here from invi
. Vi
does not allow to yank rectangular blocks of text,but screen
does. Press
c or C to set the left or right margin respectively. If norepeat count is given, both default to the current cursor position.
Example: Try this on a rather full text screen: C-a [ M 20 l SPACE c 10 l 5 j C SPACE.
This moves one to the middle line of the screen, moves in 20 columns left,marks the beginning of the paste buffer, sets the left column, moves 5 columnsdown, sets the right column, and then marks the end ofthe paste buffer. Now try:
C-a [ M 20 l SPACE 10 l 5 j SPACE
and notice the difference in the amount of text copied.
J joins lines. It toggles between 3 modes: lines separated by anewline character (012), lines glued seamless, or lines separated by asingle space. Note that you can prepend the newline character witha carriage return character, by issuing a set crlf on
.
v is for all the vi
users who use :set numbers
- ittoggles the left margin between column 9 and 1.
a before the final space key turns on append mode. Thusthe contents of the paste buffer will not be overwritten, but appended to.
A turns on append mode and sets a (second) mark.
> sets the (second) mark and writes the contents of the paste bufferto the screen-exchange file (`/tmp/screen-exchange' per default)once copy-mode is finished. See section Screen-Exchange.
This example demonstrates how to dump thewhole scrollback buffer to that file:
C-a [ g SPACE G $ >.
C-g gives information about the current line and column.
@ does nothing. Absolutely nothing. Does not even exit copymode.
Paste
Command: paste [registers [destination]]
(C-a ], C-a C-])
Write the (concatenated) contents of the specified registers to the stdin stream of the current window. The register `.' is treated as thepaste buffer. If no parameter is specified the user is prompted to enter a single register. The paste buffer can be filled with the copy
, history
and readbuf
commands.Other registers can be filled with the register
, readreg
andpaste
commands.If paste
is called with a second argument, the contents of the specifiedregisters is pasted into the named destination register rather thanthe window. If `.' is used as the second argument, the display's paste buffer is the destination.Note, that paste
uses a wide variety of resources: Usually both, a current window and a current display are required. But whenever a secondargument is specified no current window is needed. When the source specificationonly contains registers (not the paste buffer) then there need not be a currentdisplay (terminal attached), as the registers are a global resource. Thepaste buffer exists once for every user.
Tell screen to include font information in the paste buffer. Thedefault is not to do so. This command is especially usefull formulti character fonts like kanji.
(none)
Define the speed text is inserted by the paste
command.If the slowpaste value is nonzero text is written character by character.screen
will pause for msec milliseconds after each writeto allow the application to process the input. only use slowpaste
if your underlying system exposes flow control problems while pasting large amounts of text.
Command: readreg [register [filename]]
(none)
Does one of two things, dependent on number of arguments: with zero or onearguments it it duplicates the paste buffer contents into the register specifiedor entered at the prompt. With two arguments it reads the contents of the namedfile into the register, just as readbuf
reads the screen-exchange fileinto the paste buffer.The following example will paste the system's password file intothe screen window (using register p, where a copy remains):
C-a : readreg p /etc/passwdC-a : paste p
Registers
(none)
Removed. Use readreg
instead.
(none)
Removed. Use paste
instead.
(none)
Stuff the contents of the specified register into the screen
input queue. If no argument is given you are prompted for aregister name. The text is parsed as if it had been typed in from the user'skeyboard. This command can be used to bind multiple actions to a single key.
(none)
Save the specified string to the register key.
(none)
Stuff the string string in the input buffer of the current window.This is like the paste
command, but with much less overhead.You cannot paste large buffers with the stuff
command. It is mostuseful for key bindings. See section Bindkey
Screen-Exchange
Command: bufferfile [exchange-file]
(none)
Change the filename used for reading and writing with the paste buffer.If the exchange-file parameter is omitted, screen
revertsto the default of `/tmp/screen-exchange'. The following examplewill paste the system's password file into the screen window (using the paste buffer, where a copy remains):
C-a : bufferfile /etc/passwdC-a < C-a ]C-a : bufferfile
(C-a <)
Reads the contents of the current screen-exchange file into the paste buffer.
(C-a =)
Unlinks the screen-exchange file.
(C-a >)
Writes the contents of the paste buffer to a public accessiblescreen-exchange file. This is thought of as a primitive means ofcommunication between screen
users on the same host. See alsoC-a ESC (see section Copying).
History
(C-a {)
Usually users work with a shell that allows easy access to previouscommands. For example, csh
has the command !!
to repeatthe last command executed. screen
provides a primitive way ofrecalling "the command that started ...": You just type the firstletter of that command, then hit C-a { and screen
tries tofind a previous line that matches with the prompt character to the leftof the cursor. This line is pasted into this window's input queue. Thusyou have a crude command history (made up by the visible window and itsscrollback buffer).
Go to the previous, next section.