The ls command list the files and directories (and other items) in a given directory. It can be asked to colour the output that it produces to give you an indication of what each file is and what permissions it has. Since I always forget what colour means what here’s a handy list of what each colour means.
- Blue – Directory
- Green – Executable File
- Red – Archive or Broken Symbolic Link
- Magenta – Image
- Cyan – Symbolic Link
- White – Regular File
For completeness here’s a screen shot:
It’s probably worth pointing out that this is under Kubuntu 11.04. I’m not sure but I think these colours are fairly standard across all distributions though. You can change the colours if you are feeling up for a bit of a challenge although I’ve not gone looking for where you would change the default settings.
There are a couple of other colours that are defined but they aren’t seen all the often. There’s black text on a yellow background which I believe is used when a file has a sticky GID set (/sbin/unix_chkpwd for example).
To turn on colouring you can either add the appropriate switch to ls each time or more simply change your ~/.bashrc file. A default install comes with various ls aliases already defined bur commented out. Just remove the comment characters from the ones that you want to use. For example there is one in there that always applies colour to ls:
alias ls='ls --color=auto'
The other one that I like to have is ll which is ls with long listing
alias ll='ls -alF'
If you put this second alias after the first you will get colouring automatically.