When I search for some files under a dir, I run
find dir -name pattern
But I find that the following will return all the files under dir
, regardless what pattern
is:
find pattern dir
is it just like tree dir
?
Why is it?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityWhen I search for some files under a dir, I run
find dir -name pattern
But I find that the following will return all the files under dir
, regardless what pattern
is:
find pattern dir
is it just like tree dir
?
Why is it?
find
can take many dirs as arguments:
find dir1 dir2 dir3 -name pattern
so find patern dir
just lists everything inside two directories: pattern and dir.
In find, when you use the -name
that means only output files with that name as a result