xterm-256color: Unknown terminal type

Problem

If you connect to a Solaris by ssh from Linux or MacOSX you can get the following message when using vi:

# vi httpd.conf
xterm-256color: Unknown terminal type
I don't know what kind of terminal you are on - all I have is 'xterm-256color'.
[Using open mode]
"httpd.conf" 705 lines, 24071 characters
#
# This is the main Apache HTTP server configuration file. It contains the

Solution

Define the TERM environment variable:

# export TERM=xterm

Now you can execute vi:

# vi httpd.conf

This change is valid just for the current Terminal session. If you want to make it permanent you have to add that export to your ~/.bashrc file. If you want to make the change permanent for all the users you can edit the /etc/profile file or add a new file in /etc/profile.d/

Advertisements

9 thoughts on “xterm-256color: Unknown terminal type

  1. Wow, amazingly!

    I so long sought this solution , because without it alsamixer and other application not worked via ssh.

    Thanks a lot, Respect!

    Regards, Roman.

  2. Cheers for the tip. i was having trouble on solaris with the MacOS terminal. this worked fine.

    P.S if others are having trouble with this issue, pressing j on the remote system will list the file line by line (but just type in the above and it displays the vi file as it should)

  3. Thanks! Awesome fix for the problem i was encountering.
    Not only I was able to use the vi editor.. other commands like ‘clear’ etc are
    now working too!

  4. tl;dr: This worked for me! Thank you!!

    It was a university shell account, on SunOS. I’m on macOS Sierra, which is reporting terminal as xterm-256color. Apparently SunOS doesn’t recognize that. But putting export TERM=xterm in my .bashrc file fixed it right up.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s