infocmp Command in Linux



The infocmp command in Linux displays or compares terminfo entries. Terminfo is a database used in UNIX and Linux systems that defines the capabilities and control sequences of various types of terminals. It can be accessed from the /usr/share/terminfo file.

The infocmp compares binary terminfo entries, rewrites terminfo descriptions using the use= field, or prints them in various formats. It outputs Boolean fields first, followed by numeric and string fields.

Table of Contents

Here is a comprehensive guide to the options available with the infocmp command −

Syntax of infocmp Command

The syntax of the Linux infocmp command is as follows −

infocmp [options] [termname]

The [options] field is used to specify the options to modify the command's behavior. The [termname] field is used to specify the terminal name whose description must be displayed such as xterm, tmux, or screen.

Options of infocmp Command

The options of the infocmp command are listed below −

OptionsDescription
-0To display output in a single-line
-1To display output in a single-column
-CTo display termcap names
-DTo display database locations
-ETo format output as C tables
-FTo compare terminfo-files
-GTo format %{number} to %'char'
-ITo display terminfo-names
-LTo display long C variable names
-R subsetTo restrict output to a given subset
-TTo eliminate size limits on the generated text (for testing and analysis)
-UTo skip post-process entries capabilities
-VTo display the command version
-WTo wrap long strings per -w[n]
-aIf used with -F, list commented-out caps
-cTo list common capabilities
-dTo list different capabilities
-eTo format output for C initializer
-fIf used with -1, format complex strings
-gTo format %'char' to %{number}
-iTo analyze initialization/reset
-lTo display terminfo names
-nTo list capabilities in neither
-pTo ignore padding specifiers
-Q numberTo dump compiled description
-qFor a brief listing, omits headers
-rIf used with -C, output in termcap form and if used with -F, resolve use-references
-s [d|i|l|c]To sort fields according to a specified argument
-tTo suppress commented-out
-uTo produce source description with 'use='
-v numberTo display verbose output
-w numberTo change output width by a specified number(characters)
-xTo display information for user-defined capabilities

Examples of infocmp Command in Linux

This section demonstrates the usage of the infocmp command in Linux with examples −

Displaying Description of Current Terminal

To display the description of the current terminal, use the infocmp command without any option −

infocmp
infocmp Command in Linux1

Displaying Description of the Current Terminal using Curses Capability Names

To print out the current terminal description using the curses capability names (the long C variable names), use the -L option −

infocmp -L
infocmp Command in Linux2

Displaying Description of the Current Terminal using Capability Names

To display the current terminal description using capability names (capname), use the -I option −

infocmp -I
infocmp Command in Linux3

Displaying Description of the Current Terminal using Terminal Capability

To display the current terminal description using terminal capability (termcap), use the -C option −

infocmp -C
infocmp Command in Linux4

Displaying Entries in a Single Column

To display the output in a single column, use the -1 option −

infocmp -1
infocmp Command in Linux5

To display the output in one row only, use the -0 option −

infocmp -0
infocmp Command in Linux6

Displaying Capabilities Difference

To display the difference in capabilities between the two terminals, use the -d option. For example, to display the capabilities difference between xterm and screen, use the command given below −

infocmp -d xterm screen
infocmp Command in Linux7

In the output, F indicates False, entry not present; T indicates True, entry present.

Displaying Similar Capabilities in Terminal Definitions

To display the capabilities of two terminal definitions that are the same, use the -c option −

infocmp -c xterm screen
infocmp Command in Linux8

Displaying Missing Capabilities in Terminal Definitions

To display the capabilities that are not present in the specified terminal definitions, use the -u option −

infocmp -u xterm screen
infocmp Command in Linux9

Sorting the terminfo Fields

To sort the terminfo fields, use the -s option with the specified arguments such as d, i, l, c. The description of these arguments is listed below −

ArgumentsDescription
dTo sort the fields in the order they are present in terminfo
iTo sort fields by terminfo name
lTo sort by long C variable name
cTo sort by terminal capability (termcap) name

To sort the terminfo fields by termcap name, use the infocmp command in the following way −

infocmp -s c xterm
infocmp Command in Linux10

Displaying Description of a Terminal in Verbose

To display the output in verbose, use the -v option with verbosity level. For example, to display the capabilities of the xterm with the verbosity level 6, use the following command −

infocmp -v 6 xterm
infocmp Command in Linux11

Conclusion

The infocmp command in Linux is used to display terminfo entries according to specified options. It can display and compare the database entries of the current or specified terminals such as xterm, screen, or tmux.

The infocmp command offers various options to display terminal definition capabilities in different formats.

In this tutorial, we explained the infocmp command, its syntax, options, and usage in Linux with examples.