PuTTY Settings in 2019 – Now in Multicolor!

I’ve “always” used PuTTY as my SSH client on Windows. And now, in 2019, I realized that there really are some settings in PuTTY that can make a difference!

Here is my earlier normal view:

Bash prompt and the colors looked like this:

Not very modern, right?

After some adjustments, here they are now:

For me it definitely looks better!

The changes I made in PuTTY settings:

  • Terminal type from xterm to xterm-256color
  • Font from Courier New to Consolas (in addition to the different typeface it also brought the hyphenation symbol as shown above)
  • Indicate bolded text from colour to font
  • Gap between text and window edge from 1 to 3 (just a minor touch)
  • [Added note: I usually set the “Use system colours” setting enabled right from the install, and that gives me my preferred white background in PuTTY. Might depend on the Windows settings as well if you have some special theme in Windows.]

The Linux host in the screenshots above is Debian 10 buster. It didn’t require any changes, but in earlier Debian versions .bashrc contained this code:

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;
esac

(Plus some code that actually set the prompt based on the color_prompt value.) Note that it only checks the terminal type “xterm-color“, and that is not enough to support 256 colors in the terminal. You can change it to this, just like Debian buster already has it:

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

That matches “xterm-256color“, as well as other useful terminal types like “screen-256color” and “tmux-256color” (one of those is usually present while inside screen/tmux), and provides the colored prompt style shown above.

One note about using “putty-256color” terminal type in PuTTY. I experimented with it as well, and I couldn’t get Ctrl-arrow keys working in tmux with any kind of tricks. “xterm-256color” seems to work fine for now.

Update: This is the command used in the screenshots above for printing out the color samples:

for ((color=0; color<=255; color++)); do tput setaf $color; printf testing%03d $color; done; echo
Updated: November 24, 2023 — 22:16

Leave a Reply