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

I've installed Cygwin under Windows 7 and I've added the line exec zsh -l to C:\cygwin\home\Viktor\.bash_profile.

Problem is I still get that ugly new line for every command I write:

(Viktor@INET)[2] ~
$ cd D:

(Viktor@INET)[3] /cygdrive/d
$ ls
$RECYCLE.BIN  Program Files (x86)  System Volume Information  Viktor  xampp

(Viktor@INET)[4] /cygdrive/d
$ _

As horizontal space is no concern with 1920 pixels I would like to have the "Linux appearance", something like this viktor@inet> _ or whatever is default. One command shouldn't take three lines. And how do I change the colors?

Edit. I also have Console2 installed, which I have set to use Cygwin, if that's any help.

share|improve this question
up vote 2 down vote accepted

The "path prefix line thing" is called the prompt. It does not depend on the console or terminal; only on your shell.

  • In Bash, it is changed by setting the PS1 variable (usually from your .bashrc);
  • in ZSH it's PS1 or PROMPT (both are equivalent) which you set from .zshrc;
  • in the Windows cmd.exe shell – also PROMPT.

The default for ZSH appears to be %m%# ​, which expands to computername% ​​. In addition to %m and %#, there are many more substitutions (for user name, current directory, and so on) – they are documented in the zshmisc(1) manual page under "Expansion of prompt sequences". Some of them can be used to influence the formatting as well.

There are several detailed tutorials on how to customize the prompt's appearance, for example the one in Arch Linux wiki.

Note that there isn't a real "the Linux appearance" – many Linux users who use the terminal often will actually have elaborate customizations set up.

share|improve this answer
I might have to brush up on my terminology then. ;) "Prompt" does ring a bell though. Anyway, great explanation and now I have something to go on: my googlings for "cygwin remove prefix line thingie" didn't return much. Which would be the ideal shell to use as a beginner? I downloaded zsh in hope that it would change the prompt to my liking (as I think I've used zsh or xterm in Ubuntu). Is bash a stand-alone shell? I thought I read that Cygwin uses mintty as default—is bash and mintty connected somehow? – Viktor Sep 8 '12 at 10:40
@Viktor: Both Bash and ZSH are "stand-alone", and both are good shells. Bash is the most popular and has a huge amount of tutorials on the web (not all of them are good, though), while ZSH is second (but more powerful and easier to customize – e.g. "grml-zsh" or "oh-my-zsh"). /// MinTTY is a terminal (similar to Xterm or Console2 or Win32 consoles) – it just displays program output on screen. You can run any shell inside it. – grawity Sep 8 '12 at 10:59
Thanks a bunch! (I thought mintty was a shell as it was categorized under shells in the Cygwin package installer.) Anyways, I wrote a simple prompt variable which imitates the default terminal shell in the latest Ubuntu: PROMPT = '%n@%M:%1~$ ' | tr 'A-Z' 'a-z'. Although, my pipe tr does not seem to do anything. It's just an estetic change, but I would like to have it. That is, I want the whole PROMPT to be lowercased. – Viktor Sep 8 '12 at 11:24
@Viktor: Pipes and variables don't work that way. In your example, you are only running a command PROMPT=... (which sets a variable and does not output anything) and piping its output to tr. You aren't telling zsh to magically do the pipe every time it reads the value of PROMPT. /// If you want to have a lower-case hostname, try changing %M$(hostname|tr A-Z a-z). (You need to set PROMPT_SUBST for this to work.) – grawity Sep 8 '12 at 11:46
I have set PROMPT_SUBST, but I can't figure out how to use your code. How do I "map" hostname to get its value from %M? Right now I have PROMPT='%n@$(%M|tr A-Z a-z):%1~$ '. I'm sorry, I have tried reading the documentation I could find, but it doesn't make sense for me. – Viktor Sep 8 '12 at 13:31

As for "colors", try ansi-sequences. Description in my another answer.

Also, I recommend you, give a try to ConEmu - another windows terminal (I'm the author of it).

share|improve this answer
Okay, I will try that when I have some free time, just wanted to get a decent terminal environment up and going for my Perl/Prolog course. I switched back from Console2 to Cygwin as I couldn't figure out how to get UTF-8 in Console2, but I am still using zsh. I will definitely try your ConEmu, as I am not 100 % satisfied with my current. – Viktor Sep 9 '12 at 10:54

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.