I have set up my tmux to use screen-256colors and it works great with vim.

However, when I ssh to a remote host from within tmux, screen-256colors isn't recognized, so I'm getting errors like this:

E558: Terminal entry not found in terminfo 'screen-256color' not known. Available builtin terminals are:
    builtin_dumb defaulting to 'ansi'

Other than editing each remote .bashrc (similarly to this suggestion), is there any way to set the TERM correctly and automatically on the remote host?

2 Answers 2


In most cases you need to install the necessary terminfo descriptions on the remote host. Terminfo is what Linux programs use to determine how to deal with a particular terminal (what control codes to send).

For example, on Debian or Ubuntu you usually need the ncurses-base package (which collects terminfo data for all "established" terminal emulators).

Failing that, you can manually copy the terminfo data for specific terminals:

  1. On the local system, dump the description to text format:

    infocmp xterm-256color > xterm-256color.ti
    infocmp screen-256color > screen-256color.ti
  2. Copy the files to the remote host and compile them again:

    tic xterm-256color.ti
    tic screen-256color.ti

On Linux, the descriptions will be stored in ~/.terminfo. (Note that as of recent 2023 updates, this location will not be read by "setuid" programs anymore, although those are generally rare.)

infocmp and tic are part of the ncurses or ncurses-bin packages in most Linux distributions, as well as most BSDs that use ncurses (though on BSDs there might not be a per-user database).

  • Thanks for the quick and neat answer! I wish I could +2 this one
    – Yoav Aner
    Commented Jun 2, 2012 at 21:38
  • Agree. Worked like charm ! Commented Mar 11, 2014 at 10:09

I have this in my .bashrc:

alias ssh='TERM=screen ssh'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .