13

I have an error when run TOP command:

>top
'xterm': unknown terminal type.

> echo $TERM
xterm

> echo $DISPLAY
DYSPLAY: Undefined variable.

> cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)

> ls /usr/share/terminfo/
1 2 3 4 5 6 7 8 9 a A b c d e E f g h i j k l L m M n N o p P q Q r s t u v w x X z


> ls /usr/share/terminfo/x/xterm
/usr/share/terminfo/x/xterm

i have that problem also with Root.

does TOP use xterm?

How can i do?

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
Marco Rocci
  • 355
  • 1
  • 2
  • 10

3 Answers3

16

try adding

export TERM=linux

at the end of your .bashrc files (/home/myuser/.bashrc, /root/.bashrc). The problem is that the terminal definition 'xterm' is undefined

Craig
  • 419
  • 4
  • 19
5

Here is another possible cause of top terminal problems.

I had the same problem (on one particular SLES 11.3 box) - whatever I set TERM to (default was xterm), top would say "unknown terminal type".
My /usr/share/terminfo files were all fine, as was /etc/termcap, and my ncurses library.

Then I noticed that top ran fine as another user, so it must be an environment problem. I tracked it down to LD_LIBRARY_PATH, which was set to
/opt/PostgreSQL/9.3/pgAdmin3/lib:/opt/PostgreSQL/9.3/lib:
(I have PostgreSQL installed on this box).

The problem was that PostgreSQL supplies its own libncurses.so.5 library (among many others), and top doesn't work with it.

If I unset LD_LIBRARY_PATH, or make PostgreSQL's library a soft link to /usr/lib/libncurses.so, then top works fine again.

  • This was my exact problem. I ended up moving the LD_LIBRARY_PATH setup to a wrapper shell script instead of on the Dockerfile – Elmer Jun 21 '19 at 11:22
1

Instead of top, can you please try with below arguments

top -n 2 -b

it worked for me