Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I want to find all dot directory in home directory

 find  ~/ -name .*    -Olevel 1

But it can not work

share|improve this question
up vote 1 down vote accepted

The problem is that your shell is expanding .*. You want to quote it instead, i.e. '.*', so that find deals with it instead of your shell.

For example, to find all directories in your home directory,

find ~ -maxdepth 1 -type d -name '.*'

on my system, this produces:

share|improve this answer
Thanks , there is warning "find: warning: you have specified the -maxdepth option after a non-option argument -type, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments." – larry May 29 '12 at 6:49
You probably have a different version of find than I do, as I don't receive that error. I've amended my post—it should work now. – Chris Kuehl May 29 '12 at 7:41

You can use

find ~/ -maxdepth 1 -name '.*' -type -d 

You have to stop the shell from expanding the .* by putting ' around it then find then expands '.*' correctly. To find only directories use the -d switch and to limit find to the ~/ directory use -maxdepth 1.

share|improve this answer

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.