Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

The bulk of the question is in title, but to elaborate a little:

On most Linuxes I can find /usr/share/terminfo -type f. But on Solaris machine I have nearby - this directory doesn't even exist.

I could iterate over a list of terminals, and do something like:

for TERM in xterm xtermc xterm-color xterm-256color screen rxvt
    tput cols >/dev/null 2>/dev/null && echo "$TERM available"

But it's slow. Any options to discover path used by tput to terminal definitions, and run "find" myself?

share|improve this question

3 Answers 3

up vote 6 down vote accepted

On Solaris 10 you can do:

find /usr/share/lib/terminfo -type f -print

You should be able to do something like:

find /usr -type d -name terminfo -print

to find where the directory is located.

You can also read to find the exact path:

man terminfo
share|improve this answer
This is great, but I have one small problem with it - how can I find the path, without grepping man output? It there any way to do it? – user14382 Jan 26 '12 at 15:36
I've amended the answer. – Karlson Jan 26 '12 at 15:51

The infocmp program on "any" system supporting terminfo happens to show the pathname where it finds the terminal description for the current terminal. For example (AIX in this case):

$ infocmp vt100
#       Reconstructed via infocmp from file: /usr/share/lib/terminfo/v/vt100
vt100|vt100-am|Digital VT100,
        am, msgr, xenl, xon,
        cols#80, it#8, lines#24, vt#3,

For ncurses, it is more complicated, because you can have multiple terminfo databases, and the entries need not be individual files. A single database and one file per entry is the default, for compatibility with Unix systems.

The -D option for tic and infocmp (added late in 2011) is one way to show the extra information. For example, on my Debian7, I can see this:

$ infocmp6 -D

On my FreeBSD 10 machine, I use hashed databases:

$ infocmp -D

Alternatively, one can use the toe program to produce a report of all of the available terminal entries. Using the -s and -a options lets it combine things (like the conflict program):

--> /users/tom/.terminfo
----> /usr/local/ncurses/share/terminfo
------> /usr/share/terminfo
--------> /lib/terminfo
--*-+---:       9term           Plan9 terminal emulator for X
--*---*-:       Eterm           Eterm with xterm-style color support (X Window System)
--*-*---:       Eterm-256color  Eterm with xterm 256-colors
--*-*---:       Eterm-88color   Eterm with 88 colors
--*-+---:       MtxOrb          Generic Matrix Orbital LCD display
--*-+---:       MtxOrb162       16x2 Matrix Orbital LCD display
--*-+---:       MtxOrb204       20x4 Matrix Orbital LCD display
--*-+---:       NCR260VT300WPP  NCR 2900_260 vt300 wide mode pc+  kybd
--*-+---:       aaa             ann arbor ambassador/30 lines
--*-+---:       aaa+dec         ann arbor ambassador in dec vt100 mode
--*-+---:       aaa+rv          ann arbor ambassador in reverse video
share|improve this answer

On Linux you can use strace to see which system calls a program uses. The following will list all "open(2)" system calls and filter them through sed to show, hopefully, the terminfo file used by tput to translate the terminfo capability for the current terminal.

TERMINFO_FILE=$(strace -e open tput cud1 2>&1 | sed -n -e 's/^.*\(".*terminfo.*"\).*$/\1/p')

Note that that sed expression assumes that your terminfo files are stored in a path with the pattern "terminfo" in it. If that worries you then you could use a different assumption and pick the last "open" system call.

TERMINFO_FILE=$(strace -e open tput cud1 2>&1 | grep -e "^open" | tail -n 1 | sed -n -e 's/^.*\(".*"\).*$/\1/p')

Finally, you can just dump the list of terminfo search paths using infocmp -D or tic -D. These will list their compiled-in terminfo search paths. These are the same paths searched by curses.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.