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.

thanks.

link|improve this question

70% accept rate
feedback

migrated from stackoverflow.com Apr 30 '10 at 22:33

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 4 down vote accepted

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).

link|improve this answer
feedback

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.

link|improve this answer
2  
Any program can open hidden files. Just press Cmd-Shift-. in the file dialog. – Daniel Beck Feb 8 '11 at 11:42
Whoa, I had no idea about that. Nice tip! – Scottie Feb 9 '11 at 10:03
feedback

Your Answer

 
or
required, but never shown

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