Originally, I was trying to determine why some directories show up differently colored than others when using the ls command.

While playing around with this. I have now encountered the problem of not being able to clear the screen inside a tmux terminal

$ clear
'tmux-256color': unknown terminal type.

This problem only persists in tmux, not the actual terminal itself and only showed up after trying to fix the initial problem. Also the colors have changed when running vim inside tmux now.

Here are some outputs:

outside tmux:

$ echo $TERM; tput colors; tput longname
xterm with 256 colors

inside tmux:

echo $TERM; tput colors; tput longname
tput: unknown terminal "tmux-256color"
tput: unknown terminal "tmux-256color"


my .bashrc file has:

case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;

my .tmux.conf has:

set -g default-terminal "screen-256color"
  • You haven't told the world whether the tmux terminal type is missing, too. – JdeBP Mar 24 '20 at 18:44

Your plaform doesn't have tmux-256color, you will need to either:

1) Use screen-256color instead.

2) See if you can upgrade ncurses or terminfo to a later version with tmux-256color.

3) Copy tmux-256color from another computer which does have it, you can do this by saving it with infocmp -x tmux-256color >saved then installing it with tic -x saved.

  • How do I persistently change it to your first point? I think i've done it before with export $TERM=screen-256color but after closing the terminal and restarting, the same error occured. – Douglas James Bock Mar 24 '20 at 17:47
  • The better approach is to leave it at the right terminal type, as it currently is, and use M. Marriott's second or third options. – JdeBP Mar 24 '20 at 18:42
  • Yeah, that's worked for me. point 3 is persistence. @DouglasJamesBock please vote this answer as solution. – silvio May 26 '20 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.