根據網上所說,在~/.tmux.conf中加入:
set -g default-terminal "screen-256color"
之後仍然無效。
可以試一下在tmux裏面,ls --color可不可以有顏色。如果可以的話,則在~/.bash_profile中增加對ls的alias:
alias ls="ls --color"
注意,在~/.bashrc中加是無效的,tmux讀取的是~/.bash_profile(參考:https://blog.csdn.net/williamyuyuyu/article/details/79283374)
然後重新進入tmux,執行ls,就可以有顏色了。