Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running Cygwin as an Inferior Shell in Emacs. Here's the basic step I am following:

  • C-u M-x shell (rename the buffer to cygwin)
  • cd \cygwin
  • cygwin.bat

Here's what I see:

[32muser1@mymachine [33m~[0m

If I run cygwin.bat outside of emacs, it gives me:

user1@mymachine ~

I could almost deal with the extra characters, but when I try ls here's the result:

$ ls
bash: $'ls\r': command not found

I must be doing something wrong. Any suggestions?

EDIT: M-x ansi-color-for-comint-mode-on fixed the prompt, but the system is still not able to decode the ls command.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Here's the fix for the unix linefeed junk: http://osdir.com/ml/emacs.windows/2007-12/msg00007.html

Basically, just run:

M-x set-buffer-process-coding-system

with 'undecided-unix and 'undecided-unix parameters.

Also, change the prompt to be:

export PS1="\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$"

The default PS1 causes ugly errors.

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.