I’m having trouble with the find command in bash.
I’m trying to find a file that ends with .c and has a file size bigger than 2000 bytes. I thought it would be:
find $HOME -type f -size +2000c .c$
But obviously that isn’t correct.
What am I doing wrong?
find $HOME -type f -name "*.c" -size +2000cHave a look to the
-nameswitch in the mane page:Note the suggestion at the end to always enclose the pattern inside quotes. The order of the options is not relevant. Have, again, a look to the man page:
So, options are, by default, connected with and
-andoperator: they’ve to be all true in order to find a file and the order doesn’t matter at all. The order could be relevant only for more complicated pattern matching where there are other operators than-and.