问题
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
回答1:
.
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.
回答2:
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 onefind *
looks for the visible contents only within the directory
Have a look at this answer update too, here: https://stackoverflow.com/a/22057427/6466510
来源:https://stackoverflow.com/questions/46578534/difference-between-find-and-find-in-unix