Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The default cygwin prompt of "user@computer path \n $" is too long for me. I would like to keep the path.

I want it to become:

path $

Is there a config file I can modify to do this?

share|improve this question
up vote 21 down vote accepted

The PS1 environment variable controls the prompt:

PS1='\w $ '

For more information on this and other prompt configuration topics, type man bash (assuming bash is your shell) and see the "PROMPTING" section.

To make this change permanent, edit your ~/.bashrc file to add the above line.

share|improve this answer
~/.bashrc does not get executed for a login shell. update ~/.bash_profile instead. I use the following prompt string, which has some other useful information, not just the path: PS1='[\e[32m]\t [\e[33m]\w [\e[31m]\! [\e[0m]\$ ' – bobmcn Aug 26 '09 at 20:16
Don't forget that normally .profile sources .bashrc, so that in effect, a login shell is initialized with the same stuff than a non-login shell plus what's in .profile. If that's the case, putting your new prompt in .bashrc kills two birds with one stone. – user290253 Jan 15 '14 at 14:06

A login shell is one whose first character of argument zero is a -, or one started with the --login option. When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists.

So it depends...i dont't use the --login, so i must add it to ~/.bashrc

share|improve this answer

Put this in your ~/.bashrc. Gives a coloured prompt and keeps the status in a single line.

export PS1="\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\$ "
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.