Customizing the Cygwin Terminal
Cygwin loads its settings from a file called .profile present in the HOME environment variable. By default, HOME is set to /home/<username> which in Windows can be reached in C:\cygwin\home\<username> (assuming you have installed Cygwin in C:\cygwin folder).
.profile can be opened using any text editor. Here you can set colors to be displayed, prompt, history, aliases, default working directory, and any banner you may wish. The colors you choose will interfere with the colors set in your command prompt.
Below is a sample .profile.
————————————————————————————————–
# .profile
# Define some colors first:
red=’\e[0;31m'
RED='\e[1;31m'
green='\e[0;32m'
GREEN='\e[1;32m'
yellow='\e[0;33m'
YELLOW='\e[1;33m'
blue='\e[0;34m'
BLUE='\e[1;34m'
pink='\e[0;35m'
PINK='\e[1;35m'
cyan='\e[0;36m'
CYAN='\e[1;36m'
NC='\e[0m'
# Colors and Prompt
export PS1="\[\e]2;\u@\h:\w\007$green\]\u@\h:\[$pink\]\w\[$blue\]$ \[$BLUE\]“ # Word wrap of previous line.
set -o vi
export EDITOR=vi
# History
export HISTSIZE=1000
export HISTFILE=~/.bash_history
export HISTFILESIZE=1000
# Various Aliases
alias dir=’ls –color=auto’
# Working directory
cd /e/home
# Banner
echo -e “${cyan}”
echo \ \ \ \ \ #======================#
echo \ \ \ \ \ # Welcome back Sravan!\ #
echo \ \ \ \ \ #\ \ \ I missed you.\ \ \ \ \ \ #
echo \ \ \ \ \ #======================#
echo
————————————————————————————————–
The above .profile first defines some colors. One could directly use the color codes but this is more readable. Next, it sets the prompt settings. We’ll go over what the PS1 line exactly means later. The script then sets output display settings, history file settings, aliases, default working directory and banner. Comments are prefixed with a #.
You might have to tweak some color combinations in the PS1 line. I use a variant of the above .profile in combination with a command prompt with colors mainly set to a white background and a blue text as against the default black background and a white text. This is more pleasant to my eyes, giving me a white board and a blue marker feeling.
Let me know if you need further help with this. I’m not going into detail because it is off-putting to discuss too much about colors here.
Image Source: Cygwin screenshot from my PC.















hi .. do you know if there’s a way to apply word-wrap to cygwin?
thanks
If you see the .profile above, we are setting the editor to ‘vi’, and AFAIK there is no word-wrap in Vi. But I’m not so sure.