- 1 Настройка
- 1.1 Настройка файла ресурсов
- 1.2 Прокрутка
- 1.3 Меню
- 1.4 Копирование и вставка
- 2 Цвета
- 3 Шрифты
- 4 Советы и хитрости
- 5 Решение проблем
- 6 Смотрите также
Настройка файла ресурсов
Есть несколько опций, которые вы можете задать в файле Ресурсы Х, они помогут сделать этот эмулятор терминала гораздо проще в использовании. Смотрите полный список
Переменная окружения TERM
Allow xterm to report the TERM variable correctly. Do not set the TERM variable from your ~/.bashrc or ~/.bash_profile or similar file. The terminal itself should report the correct TERM to the system so that the proper terminfo file will be used. Two usable terminfo files are xterm, and xterm-256color.
Without setting TERM explicitly, xterm should report
xterm. You can check this from within xterm using either of these commands:
$ echo $TERM $ tset -q
When TERM is not set explicitly, color schemes for some programs, such as vim, may not appear until a key is pressed or some other input occurs. This can be remedied with this resource setting:
Make certain your locale settings are correct for UTF-8. Adding the following line to your resource file will then make xterm interpret all incoming data as UTF-8 encoded:
Исправление клавиши 'Alt'
If you use the
Alt key for keyboard shortcuts, you will need this in your resource file:
As new lines are written to the bottom of the xterm window, older lines disappear from the top. To scroll up and down through the off-screen lines one can use the mouse wheel, the key combinations
Shift+PageDown, or the scrollbar.
By default, 1024 lines are saved. You can change the number of saved lines with the
Other X resources that affect scrolling are
jumpScroll, set to
true by default, and
fastScroll, both of which default to
false. To scroll inside an alternate screen, set
The scrollbar is not shown by default. It can be made visible by a menu selection, by command line options, or by setting resource values. It can be made to appear to the left or right of the window and its visual appearance can be modified through resource settings.
The scrollbar operates differently from what you may be accustomed to using.
- To scroll down:
- – Click on the scrollbar with the left mouse button.
- – Click on the scrollbar below the thumb with the middle mouse button.
- To scroll up:
- – Click on the scrollbar with the right mouse button.
- – Click on the scrollbar above the thumb with the middle mouse button.
- To position text, moving in either direction:
- – Grab the thumb and use "click-and-drag" with the middle mouse button.
The Archlinux version of xterm is compiled with the toolbar, or menubar, disabled. The menus are still available as popups when you press
Ctrl+MouseButton within the xterm window. The actions invoked by the menu items can often be accomplished using command line options or by setting resource values.
Some of the menu options are discussed below.
Главные опции меню
Ctrl + LeftMouse
Secure Keyboardattempts to ensure only the xterm window, and no other application, receives your keystrokes. The display changes to reverse video when it is invoked. If the display is not in reverse video, the Secure Keyboard mode is not in effect. Please read the "SECURITY" section of the xterm man page for this option's limitations.
Allow SendEventsallows other processes to send keypress and mouse events to the xterm window. Because of the security risk, do not enable this unless you are very sure you know what you are doing.
Log to File– The log file will be named
Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX. This file will contain all the printed output and all cursor movements. Logging may be a security risk.
- The six
Send *** Signalmenu items are not often useful, except when your keyboard fails.
KILLwill close the xterm window.
KILLshould be avoided, as it does not allow any cleanup code to run.
Quitmenu item will also close the xterm window – it is the same as sending a
HUPsignal. Most users will use the keyboard combination
Ctrl+dor will type
exitto close an xterm instance.
Опции меню VT
Ctrl + MiddleMouse
Select to Clipboard– Normally, selected text is stored in PRIMARY, to be pasted with
Shift+Insertor by using the middle mouse button. By toggling this option to on, selected text will use CLIPBOARD, allowing you to paste the text selected in an xterm window into a GUI application using
Ctrl+v. The corresponding XTerm resource is
Show Alternate Screen– When you use an a terminal application such as vim, or less, the alternate screen is opened. The main VT window, now hidden, remains in memory. You can view this main window, but not issue any commands in it, by toggling this menu option. You are able to select and copy text from this main window.
Show Tek Windowand
Switch to Tek Mode– The Tektronix 4014 was a graphics terminal from the 1970s used for CAD and plotting applications. The command line program
graph, from , and the application can be made to use xterm's Tek emulation; most people will prefer more modern display options for charting data. See the #Tek 4014 demonstration[broken link: invalid section], below.
Шрифты меню VT
Ctrl + RightMouse
- When using XLFD fonts, the first seven menu items will change the font face and the font size used in the current xterm window. If you are using an Xft font, only the font size will change, the font face will not change with the different selections, .
Selection, when using XLFD font names, allows you to switch to the font name stored in the PRIMARY selection (or CLIPBOARD).
Опции меню Tek
From the Tek Window, Ctrl + MiddleMouse
The first section's options allow you to change the Tek window font size. The second set of options are used to move the focus between the Tek emulation window and the main, or VT, window and to close or hide the Tek window.
Копирование и вставка
First, highlighting text using the mouse in an xterm (or alternatively another application) will select the text to copy, then clicking the mouse middle-button will paste that highlighted text. Also the key combination
Shift+Insert will paste highlighted text, but only within an xterm.
PRIMARY или CLIPBOARD
By default, xterm, and many other applications running under X, copy highlighted text into a buffer called the PRIMARY selection. The PRIMARY selection is short-lived; the text is immediately replaced by a new PRIMARY selection as soon as another piece of text is highlighted. Some applications will allow you to paste PRIMARY selections by using the middle-mouse, but not
Shift+Insert, and some other applications may not allow pasting from PRIMARY entirely.
There is another buffer used for copied text called the CLIPBOARD selection. The text in the CLIPBOARD is long-lived, remaining available until a user actively overwrites it. Applications that use
Ctrl+x for text copying and cutting operations, and
Ctrl+v for pasting, are using the CLIPBOARD.
The fleeting nature of the PRIMARY selection, where copied text is lost as soon as another selection is highlighted, annoys some users. Xterm allows the user to switch between the use of PRIMARY and CLIPBOARD using
Select to Clipboard on the #VT Options menu[broken link: invalid section] or with the
PRIMARY и CLIPBOARD
With the above setting you can select if you want to use PRIMARY or CLIPBOARD, but to use both you need a 'hack'. For example, put this in your .Xresources:
XTerm*VT100.translations: #override <Btn1Up>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0)
The new user usually discovers that text may be selected using a "click-and-drag" with the left mouse button. Double-clicking will select a word, where a word is defined as consecutive alphabetic characters plus the underscore, or the Basic Regular Expression (BRE)
[A-Za-z_]. Triple-clicking selects a line, with a "tab" character usually copied as multiple "space" characters.
Another way of selecting text, especially useful when copying more than one full screen, is:
- Left-click at the start of the intended selection.
- Scroll to where the end of the selection is visible.
- Right-click at the end of the selection.
You do not have to be precise immediately with the right-click – any highlighted selection may be extended or shortened by using a right-click.
You can clear any selected text by left-clicking once, anywhere within the xterm window.
Xterm defaults to black text, the foreground color, on a white background. The foreground and background colors can be reversed using the Опции меню VT or with the
-rv command line option.
$ xterm -rv
Xterm's foreground color (the text color) and the background color may be set from the command line, using the options
xterm -fg PapayaWhip -bg "rgb:00/00/80"
The first sixteen terminal colors, as well as the foreground and background colors, may be set from an Ресурсы Х file:
XTerm*foreground: rgb:b2/b2/b2 XTerm*background: rgb:08/08/08 XTerm*color0: rgb:28/28/28 ! ...Lines omitted... XTerm*color15: rgb:e4/e4/e4
Many suggestions for color schemes can be viewed in the forum thread, Terminal Colour Scheme Screenshots.
Xterm's default font is the bitmap font named by the X Logical Font Description alias
fixed, often resolving to
This font, also aliased to the name
6x13, has remakably wide coverage for unicode glyphs. The default "TrueType" font is the 14‑point font matched by the name
mono. The FreeType font that will be used can be found with this command:
$ fc-match mono
Fonts can be specified from the command line, with the options
-fn for bitmap font names and
-fa for Xft names. The example below allows you to alternate between the two fonts by toggling
TrueType Fonts from the #VT Fonts menu[broken link: invalid section].
$ xterm -fn 7x13 -fa "Liberation Mono:size=10:antialias=false"
For a more permanent change, the default fonts may be set in an Ресурсы Х file:
xterm*faceName: Liberation Mono:size=10:antialias=false xterm*font: 7x13
Жирные и подчеркнутые шрифты
Italic fonts are shown as underlined characters when using XLFD names in xterm. TrueType fonts should use an oblique typeface.
If you do not specify a bold font at the command line,
-fb, or through the
boldFont resource, xterm will attempt to find a bold font matching the normal font. If a matching font is not found, the bold font will be created by "overstriking" the normal font.
Many fonts do not contain glyphs for the double width Chinese, Japanese and Korean languages. Other terminal emulators such as urxvt may be better suited if you frequently work with these languages.
Using bitmapped XLFD fonts with CJK has many pitfalls in xterm. It is much easier to use TrueType fonts for CJK display, using the
faceNameDoublesize resource. This example uses DejaVu Sans Mono as the normal font and WenQuanYi Bitmap Song as the double width font:
xterm*faceName: DejaVu Sans Mono:style=Book:antialias=false xterm*faceNameDoublesize: WenQuanYi Bitmap Song xterm*faceSize: 8
Советы и хитрости
[ -n "$XTERM_VERSION" ] && transset-df -a >/dev/null
Now, each time you launch a shell in an xterm and a composite manager is running, the xterm window will be transparent.
The test in front of
transset-df keeps transet from executing if
XTERM_VERSION is not defined. Note that your terminal will not be transparent if you launch a program other than a shell this way. It is probably possible to work around this if you want the functionality.
Also see Per-application transparency.
Enable bell urgency
Add the following line to your
Советы по шрифтам
Используйте цвета вместо жирного и курсивного
When using small font sizes, bold or italic characters may be difficult to read. One solution is to turn off bolding and underlining or italics and use color instead. This example does just that:
! Forbid bold font faces; bold type is light blue. XTerm*colorBDMode: true XTerm*colorBD: rgb:82/a4/d3 ! Do not underscore text, underlined text is white. XTerm*colorULMode: true XTerm*colorUL: rgb:e4/e4/e4
Отрегулируйте расстояние между строками
Lines of text can sometimes be too close together, or they may appear to be too widely spaced. For one example, using DejaVu Sans Mono, the low underscore glyph may butt against CJK glyphs or the cursor block in the line below. Line spacing, called leading by typographers, can be adjusted using the
scaleHeight resource. Here, the line spacing is widened:
Valid values for
scaleHeight range from
1.0 being the default.
Удалите чёрную границу
Xterm has a black border in some cases, you can disable this by adding the following line to your
Демонстрация Tek 4014
$ xterm -t -tn tek4014
Your PS1 prompt will not render correctly, if it appears at all. In the new window, enter the command,
A world map will appear in the Tek window. You can also view other
*.tek files from that same directory. To close the Tek window, one can use the xterm menus.
Мерцание при прокрутке
Rebuild xterm using ABS and include the
./configure --prefix=/usr \ ... --with-utempter \ --enable-double-buffer
See Xterm modifications for details.