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 −

Options Description
-0 To display output in a single-line
-1 To display output in a single-column
-C To display termcap names
-D To display database locations
-E To format output as C tables
-F To compare terminfo-files
-G To format %{number} to %'char'
-I To display terminfo-names
-L To display long C variable names
-R subset To restrict output to a given subset
-T To eliminate size limits on the generated text (for testing and analysis)
-U To skip post-process entries capabilities
-V To display the command version
-W To wrap long strings per -w[n]
-a If used with -F, list commented-out caps
-c To list common capabilities
-d To list different capabilities
-e To format output for C initializer
-f If used with -1, format complex strings
-g To format %'char' to %{number}
-i To analyze initialization/reset
-l To display terminfo names
-n To list capabilities in neither
-p To ignore padding specifiers
-Q number To dump compiled description
-q For a brief listing, omits headers
-r If 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
-t To suppress commented-out
-u To produce source description with 'use='
-v number To display verbose output
-w number To change output width by a specified number(characters)
-x To 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 −

Arguments Description
d To sort the fields in the order they are present in terminfo
i To sort fields by terminfo name
l To sort by long C variable name
c To 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.

Advertisements