Read the current text color in a xterm

Rather than using obfuscated escape sequences, use the tput facility instead. Here is an excerpt from my ~/.bashrc that I use for my PS1 prompt: BLACK=$(tput setaf 0) RED=$(tput setaf 1) GREEN=$(tput setaf 2) YELLOW=$(tput setaf 3) LIME_YELLOW=$(tput setaf 190) POWDER_BLUE=$(tput setaf 153) BLUE=$(tput setaf 4) MAGENTA=$(tput setaf 5) CYAN=$(tput setaf 6) WHITE=$(tput setaf 7) … Read more

What is the difference between xterm-color & xterm-256color?

xterm-256color describes Xterm with support for 256 colors enabled. xterm-color describes an older branch of Xterm that supports eight colors. xterm-color is not recommended, since it describes a variant of Xterm that’s less functional and that you’re not likely to be using. Usually you’ll want to use xterm, xterm-16color or xterm-256color. In particular, xterm-256color is … Read more

Can’t run “ssh -X” on MacOS Sierra

I didn’t need to reinstall XQuartz, but, based on Matt Widjaja’s answer, I came up with a refinement. sudo vi /etc/ssh/ssh_config (This is ssh client config, not sshd_config) Under the Host * entry add (or add where appropriate per-host) XAuthLocation /usr/X11/bin/xauth (The location of xauth changed in Sierra) ServerAliveInterval 60 (Pings the server every 60 … Read more

Vim: Difference between t_Co=256 and term=xterm-256color in conjunction with TMUX

When you don’t use tmux or screen, you only need to configure your terminal emulators to advertise themselves as “capable of displaying 256 colors” by setting their TERM to xterm-256color or any comparable value that works with your terminals and platforms. How you do it will depend on the terminal emulator and is outside of … Read more

Bind Ctrl+Tab and Ctrl+Shift+Tab in tmux

Recent “unreleased” versions of tmux do automatically recognize those xterm-style key sequences once you have your terminal sending them (no need to change your terminfo entry). The next release version (1.8?) should also have this support. With an appropriate build of tmux1, all you have to do is bind the keys in your tmux configuration: … Read more

Set screen-title from shellscript

You can set the screen / xterm title using the following lines: #!/bin/bash mytitle=”Some title” echo -e ‘\033k’$mytitle’\033\\’ [UPDATE] – by request I’m also including the solution proposed by @Espo below: Depending on your xterm version or your linux distribution the line above may or may not work and you can try the xterm-defaults: #!/bin/bash … Read more