How could I enable syntax highlighting on the shell and in emacs when I use Terminal.app on Mac OS X to ssh into other machines? Right now if I ssh and do an "ls" for example, directories are not shown in a different color from flat files, for example, and I'd like to fix that.


2 Answers 2


Do you have a .bashrc or similar on those machines that you are ssh'ing to? I believe that is what you need, with something like alias ls="ls --color=auto" or alias ls="ls -G"(depending on your ls) in each (for ls; there are lots of other options to do other colors with other terminal programs).


In OS X, you need to add alias ls="ls -G" to your ~/.bash_profile file. The file is originally hidden, so you'll need to either show hidden files in the Finder or use a program like Textmate that can open hidden files.

  • 3
    Any program can open hidden files. Just press Cmd-Shift-. in the file dialog.
    – Daniel Beck
    Feb 8, 2011 at 11:42
  • Whoa, I had no idea about that. Nice tip!
    – Scott
    Feb 9, 2011 at 10:03

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.