Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I understand that .DS_store files serve a purpose. That said, they are a nuisance when auto-completing with the cd command. When I type cd in Terminal and press tab twice it lists all directories in the working directory.

Is there a way of removing .DS_store from this auto-complete directory listing in the terminal?

share|improve this question
When I type cd in Terminal then key Tab twice: there's a prompt before all possibilities (not only directories) are listed. –  Graham Perrin Nov 13 '12 at 1:16
That's seems like better behaviour; Do you know how to prevent listing of files when double tabbing after cd? –  Jeromy Anglim Nov 13 '12 at 1:23
cd */ followed by two tabs lists all subdirectories of the current directory. But you have to backspace to select one... –  lhf Nov 13 '12 at 1:38
@lhf Thanks. It's good to have that option. It would be better if cd was smart enough to only list directories by default. –  Jeromy Anglim Nov 13 '12 at 1:45
add comment

1 Answer 1

up vote 5 down vote accepted

export FIGNORE=DS_Store works for me.

The GNU Bash manual provides extensive information on programmable completion.

Specifically, from the documentation on bash variables

FIGNORE [is a] colon-separated list of suffixes to ignore when performing filename completion. A file name whose suffix matches one of the entries in FIGNORE is excluded from the list of matched file names. A sample value is ‘.o:~’

If you are concerned that there might be existing suffixes in FIGNORE, then you can use:

share|improve this answer
add comment

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.