====== Terminal Manipulations ====== ===== Basics ===== ===== Extras ===== ''screen'' is flexible about flow control. Traditionally, some terminals do flow control in-band, using ''^S'' when they want to stop the flow data and ''^Q'' when they want it to resume. On the other hand, some programs (such as ''emacs'') use those keys for other purposes. If flow control is turned on in ''screen'', ''^S'' will stop ''screen'' from sending anything more to your terminal and ''^Q'' will resume. Turning flow control off allows those characters to pass through to your programs. The default setting is "auto", which attempts to determine if flow control is needed or not. ''screen'' is generally pretty good at figuring this out. ''screen'' can deal with multiple character sets and character encodings. The ''[[commands:encoding]]'' and ''[[commands:defencoding]]'' commands can be used to set window encodings or override the detected terminal encoding. If the display's and window's encodings differ, ''screen'' will translate between the two. Characters not in the display's charset are represented by question marks. ''screen'' does its own encoding and only supports a handful of encodings. As of version 4.0.2, those are: C, eucJP, SJIS, eucKR, eucCN, Big5, KOI8-R, CP1251, UTF-8, ISO8859-2, ISO8859-3, ISO8859-4, ISO8859-5, ISO8859-6, ISO8859-7, ISO8859-8, ISO8859-9, ISO8859-10, ISO8859-15, jis, and GBK. [//This somehow ties in with the ''[[commands:charset]]'' setting, but I don't understand that one. //] You can alter various aspects of screen's use of termcap and terminfo, via the ''[[commands:termcap]]'', ''[[commands:terminfo]]'', and ''[[commands:termcapinfo]]'' commands. All three have the same syntax. Using ''[[commands:termcapinfo]]'' is recommended, since that affects both termcap and terminfo settings. Note that all three require the use of termcap names; terminfo-style long names are not supported. The most common use of these commands is to change how ''screen'' treats display terminals. If you want to change a termcap setting for, say, xterms, you can use the ''[[commands:termcapinfo]]'' command to change the termcap definition that ''screen'' uses for that terminal type. This affects only ''screen'', and can be used to effect changes when you don't want to or can't change the system terminal definitions. There are also several [[man:special terminal capabilities]] that are ''screen''-specific. See the "Examples" section below for specific examples. The other use is to change the terminal capabilities of ''screen'''s virtual terminal. This can be useful to alter how other programs interact with ''screen'', without having to edit ''screen'''s source code and recompile. [//This is ugly. I need to rewrite it to make it clearer. //] Some programs use ANSI escape sequences to print data; this was originally used in the days when serial terminals were common, and a terminal might have a printer directly attached to it. Any sequence starting with ''[5i'' and ending with ''\'' would cause the data between the two escape sequences to be printed. ''screen'' supports this behavior in two ways: if the display terminal has the ''po'' and ''pf'' termcap entries (indicating that it understands printing escapes), ''screen'' will pass any print requests through to the display terminal. Alternately, you can use the ''[[commands:printcmd]]'' command to define a program to which ''screen'' will send any print jobs. ===== Keybindings ===== * ''C-a C-b'' - (''[[commands:break]]'') Sends a break signal to the current window. * ''C-a B'' - (''[[commands:pow_break]]'') Closes and reopens the terminal and sends a break signal. * ''C-a f'' - (''[[commands:flow]]'') Toggle flow setting between on, off, and auto. * ''C-a q'' - (''[[commands:xon]]'') Sends an XON (^Q) to the current window. * ''C-a r'' - (''[[commands:wrap]]'') Toggle the current window's line-wrap setting. * ''C-a S'' - (''[[commands:xoff]]'') Sends an XOFF (^S) to the current window. * ''C-a Z'' - (''[[commands:reset]]'') Reset the window's terminal settings to its defaults. * ''C-a .'' - (''[[commands:dumptermcap]]'') Write out a .termcap file. ===== Commands ===== * ''[[commands:allpartial]]'' - Global command equivalent to setting ''[[commands:partial]]'' for all current windows. * ''[[commands:altscreen]]'' - Enables "alternate screen" support (''ti'' and ''te'' termcap settings) for ''screen'' windows. * ''[[commands:bce]]'' - Sets or toggle background-color-erase setting. * ''[[commands:breaktype]]'' - Currently a synonym for ''[[commands:defbreaktype]]'' * ''[[commands:c1]]'' - Sets or toggles c1 code processing. * ''[[commands:charset]]'' - Change the current character set slot designation and charset mapping. * ''[[commands:defbce]]'' - Same as ''[[commands:bce]]'', but sets the default setting for new windows. * ''[[commands:defbreaktype]]'' - Sets the type of break signal sent via the ''[[commands:break]]'' or ''[[commands:pow_break]]'' command. * ''[[commands:defc1]]'' - Same as ''[[commands:c1]]'', but sets the default setting for new windows. * ''[[commands:defcharset]]'' - Same as ''[[commands:charset]]'', but sets the default setting for new windows. * ''[[commands:defflow]]'' - Same as ''[[commands:flow]]'', but sets the default setting for new windows. * ''[[commands:defgr]]'' - Same as ''[[commands:gr]]'', but sets the default setting for new windows. * ''[[commands:defencoding]]'' - Same as ''[[commands:encoding]]'', but sets the default setting for new windows. * ''[[commands:defnonblock]]'' - Same as ''[[commands:nonblock]]'', but sets the default setting for new displays. * ''[[commands:defutf8]]'' - Same as ''[[commands:utf8]]'', but sets the default setting for new windows. * ''[[commands:defwrap]]'' - Same as ''[[commands:wrap]]'', but sets the default setting for new windows. * ''[[commands:dinfo]]'' - Shows what settings ''screen'' is using for the current display. * ''[[commands:dumptermcap]]'' - Tells ''screen'' to create a .termcap file in its socket directory. * ''[[commands:encoding]]'' - Sets the character encoding for the current window. * ''[[commands:flow]]'' - Sets the current window's flow control mode. * ''[[commands:gr]]'' - Sets or toggles GR charset switching. * ''[[commands:nonblock]]'' - Sets or toggles ''screen'''s behavior when a display stops receiving characters. * ''[[commands:partial]]'' - Sets whether ''screen'' should draw the entire window when switching windows. * ''[[commands:printcmd]]'' - Shows or sets the command used for handling the ANSI print sequence ''ESC [ 5 i''. * ''[[commands:reset]]'' - Resets the current window's virtual terminal settings to their default settings. * ''[[commands:term]]'' - Changes the value of $TERM that screen passes to its windows' child processes. * ''[[commands:termcap]]'', ''[[commands:terminfo]]'', and ''[[commands:termcapinfo]]'' - Tweak termcap and/or terminfo entries for either ''screen'''s interaction with the display terminal or for the virtual terminal presented to child programs. * ''[[commands:utf8]]'' - Changes or toggles the encoding on the current window. * ''[[commands:wrap]]'' - Sets or toggles the current window's line wrap setting. * ''[[commands:xoff]]'' - Sends an XOFF (''^S'') to the current window. * ''[[commands:xon]]'' - Sends an XON (''^Q'') to the current window. * ''[[commands:zmodem]]'' - Sets ''screen'''s handling of zmodem communcations. ===== Examples ===== Upon being asked to print a block of text, save it to a file in the user's home directory: printcmd "cat > ${HOME}/screenprint" Upon being asked to print a block of text, print it via ''lpr'': printcmd lpr Set the ''LP'' capability (the last screen position can be updated) and remove the ''hs'' capability (presence of a hardstatus line) from terminals that start with "xterm": termcap xterm* LP:hs@ On VT102s and VT220s, set the escape characters to enter (''Z0'') and exit (''Z1'') 132-column mode: termcap vt102|vt220 Z0=\E[?3h:Z1=\E[?3l Add function key labels to the termcap entries for screen's virtual terminal. For purposes of modifying the windows' termcap entries, the term-type specified doesn't matter: termcap vt100 "" l0=PF1:l1=PF2:l2=PF3:l3=PF4 Abuse ''screen'''s hardstatus support to put things in xterm titlebars. This tells ''screen'' that ''xterm''s (and related terminals) have a hardstatus line (''hs'') and sets the escape sequences for entering (''ts'') and leaving (''fs'') the hardstatus to the sequences for entering and leaving the titlebar. To go with that, uses ''[[commands:defhstatus]]'' to set a default message and ''[[commands:hardstatus]] off'' to tell ''screen'' not to use the hardstatus line for ''screen'' messages: termcapinfo xterm*|rxvt|gnome-terminal|konsole|kterm|Eterm 'hs:ts=\E]0;:fs=\007' defhstatus "screen ^E (^Et) | $USER@^EH" hardstatus off (FAQ) Turns off alternate screen switching in ''xterm''s, so that text in ''screen'' will go into the ''xterm'''s scrollback buffer: termcapinfo xterm ti@:te@ Uses ''screen'''s output translation capability (''XC'') to rot-13 all output. (Will not work in UTF-8 mode, apparently.): termcapinfo * XC=B%,an,AN,bo,BO,cp,CP,dq,DQ,er,ER,fs,FS,gt,GT,hu,HU,iv,IV,jw,JW,kx,KX,ly,LY,mz,MZ,na,NA,ob,OB,pc,PC,qd,QD,re,RE,sf,SF,tg,TG,uh,UH,vi,VI,wj,WJ,xk,XK,yl,YL,zm,ZM