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:

port

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.

3 Answers
3

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