Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

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

When I do an ls of a directory and a shell script is listed as a directory item, is there a way I can have a visual indication that it is a shell script ?

For example:

From /opt/local/bin 
ls -l

Displays port from MacPorts as an ordinary item:


Can I have color coding, bold or some other way to see this ? I know I can use file to check if it's a script, executable, etc., but that's an extra command I have to issue and is no better than trying to run port and then getting an error and typing ./port.



share|improve this question
up vote 3 down vote accepted

Try typing ls -G in terminal, you should see colored listings by file type. If the scripts aren't being shown in a different color, this means that they are not marked as executable, so you will need to type sudo chmod +x <filename> to make them so. Then they should appear in a different color as opposed to directorys etc.

If you prefer not to always type ls -G then you can put the following command in your .bashrc file in your home directory alias "ls"="ls -G" Then restart terminal and you should see colored output whenever you just type ls

share|improve this answer
I'm pretty sure there is an environment variable that controls ls's color options. That would be the better thing to change – Fake Name May 25 '11 at 1:56
@Fake Name - Thanks guys! This is what I was looking for. – Scott Davies May 25 '11 at 11:09

You can set this in your ~/.bash_profile file to enable colors equivalent to ls -G:

export CLICOLOR=1
share|improve this answer

As I’m not a fan of colours — they depend on the current terminal colour settings to look good — I prefer to use ls -F.

Borrowing from SCO Unix, I define an lf alias in ~/.bashrc:

alias lf="ls -F"

Executable files such as shell scripts show up with a * at the end of their names. Similarly, / for directories and @ for symbolic links.

share|improve this answer
Thanks! The color highlighting was what I was looking for, but I had no idea of the asterisk option - I'll add this to my toolkit. – Scott Davies May 25 '11 at 11:10

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.