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

2 Answers 2

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

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.