4

What is the difference between find . vs find * .

When i am trying to search for a file in current directory i.e. which was modified not more than 20 days ,i fired below query

find . -maxdepth 0 -mtime -20

The above command gives no output but

find * -maxdepth 0 -mtime -20

gives me the output that is required.Why is this happening i am searching in current directory only and . also means current directory

Lion's_Den
  • 121
  • 1
  • 7

2 Answers2

4

In addition to what @ignacio is correctly saying, you should also take into account that:

  • find . looks for hidden files too, e.g. into the .git if there's one
  • find * looks for the visible contents only within the directory

Have a look at this answer update too, here: https://stackoverflow.com/a/22057427/6466510

andreagalle
  • 620
  • 6
  • 17
2

. means "start with the current directory". A depth of 0 can only be ..

* means "start with the visible contents of the directory". A depth of 0 will be each of the visible items in the directory.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358