Patrick Bougie — web developer / entrepreneur from Montréal, Canada. Founder of WorkSked — a web app to manage employee work schedules and time off.

Hide .DS_Store file in Terminal on OS X

As a web developer using OS X, I spend a lot of time in Terminal using the Unix command line. One of my grievances is with .DS_Store files that litter our file systems. While these files are useful when navigating with OS X’s Finder, they are a nuisance when using the shell.

These instructions allow you to hide the .DS_Store files when using the Unix command line while retaining their usefulness in the Finder.

export CLICOLOR=true
export CLICOLOR_FORCE=true
function ll { ls -la $@ | grep -v .DS_Store; }

This creates a command alias ll (made up but stands for list long) with these options:

  • ls -l — Lists in long format.
  • ls -a — Lists all entries including . and ...
  • CLICOLOR and CLICOLOR_FORCE — Enables colorized output.
  • grep -v .DS_Store — Omits the .DS_Store file.

Add the above code to your ~/.bash_profile configuration file and modify it to suit your needs.

If you would also like to omit the .DS_Store files when using filename completion, add this line to your ~/.bash_profile configuration file as well:

export FIGNORE="DS_Store:$FIGNORE"

Feel free to contact me if you require development services or have any questions / comments.