tput: unknown terminal

aix
wasosa picture wasosa · Apr 28, 2009 · Viewed 13.5k times · Source

I'm on AIX-6.1 and I'm trying to make use of tput inside my $PS1. I've confirmed I can't even run tput from the commandline. Following is my session:

# tput
unknown terminal "xterm"
# echo $TERM
xterm
# tput -T ansi
unknown terminal "ansi"

In fact, ...

# ls /usr/lib/terminfo/x
x1700  xl83        xterm+pcc3  xterm+pcfkeys   xterm-88color  xterm-hp     xterm-old  xterm-vi
x1720  xtalk       xterm+pcf0  xterm+pcfn      xterm-8bit     xterm-ic     xterm-r5   xterm-vt220
x1750  xterm       xterm+pcf1  xterm-16color   xterm-basic    xterm-mono   xterm-r6   xterm-vt52
x820   xterm+pcc0  xterm+pcf2  xterm-24        xterm-bold     xterm-new    xterm-rep  xterm-xfree86
xdku   xterm+pcc1  xterm+pcf3  xterm-256color  xterm-boldso   xterm-noapp  xterm-sco  xterm-xmc
xitex  xterm+pcc2  xterm+pcfN  xterm-65        xterm-color    xterm-nrc    xterm-sun  xterms
# ls /usr/lib/terminfo/x | wc -l
       48
# for term in $(ls /usr/lib/terminfo/x) ; do tput -T $term ; done 2>&1 | grep 'unknown terminal' | wc -l
      48
# for term in $(ls /usr/lib/terminfo/x) ; do TERM=$term tput ; done 2>&1 | grep 'unknown terminal' | wc -l
  48

Any ideas? Thanks in advance.

Answer

Enfors picture Enfors · Oct 31, 2009

Is your TERMINFO variable set? Without it, I believe the system won't find your terminfo files. Or perhaps it is set incorrectly?

If you're running sh, ksh, bash or similar, try:

export TERMINFO=/usr/lib/terminfo

If you're not sure what shell you're using (I'm pretty sure you do, but others might read this too), type:

echo $SHELL

If you're using csh, tcsh or similar, then you should instead type:

setenv TERMINFO /usr/lib/terminfo

After that, try running tput again.