My default login shell is ksh which shows my default color scheme which I set via putty. But when I change my shell to bash my color scheme is lost.

Is there a way to retain the color scheme?


In order to set colors of my console window via putty , I used this link : http://vim.wikia.com/wiki/Desert_color_scheme_with_Vim_in_PuTTY

  • 1
    How exactly are you setting the scheme using putty? What colors are you referring to?
    – terdon
    Aug 27, 2013 at 15:22
  • I used this link to change color scheme for console screen via putty: vim.wikia.com/wiki/Desert_color_scheme_with_Vim_in_PuTTY
    – Lokesh
    Aug 27, 2013 at 15:27
  • Bash can set its own colors which are probably overriding your settings. Could you post your ~/.bashrc file? ALso check for ~/.Xresources.
    – terdon
    Aug 27, 2013 at 15:41
  • What is colorized on your console? ls output? In that case you need to eval $(dircolors) and set up an alias for ls=ls --color=auto. See what you have in /etc/ksh.kshrc wrt this and copy it to your .bashrc or to /etc/bashrc.
    – angus
    Aug 27, 2013 at 15:43

3 Answers 3


There isn't actually a way to do it. When you set the colors in Putty's settings it sends them as a command to the currently enabled shell. Once you change the shell it drops the colors (since they weren't saved anywhere) and you get the new shell's settings.

My suggestion would be to find the colors you like and then put them into your shells' config files. Then Putty won't need to send the files and you won't have to worry about dropping colors as you switch between them.

  • Yep. putty doesn't have any way to tell when you switch shells.
    – jthill
    Nov 19, 2013 at 18:14

I think colors for bash are set in ~/.bashrc, so I imagine the color scheme for ksh is set in ~/.kshrc. Just a guess.

  • I am setting my color scheme via putty, so profile doesn't have any settings.
    – Lokesh
    Aug 27, 2013 at 15:22

Add the following to the ~/.bashrc file in your home folder.

if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'

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.