0

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?

1

2 Answers 2

2

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.

1

In find, when you use the -name that means only output files with that name as a result

3
  • What does find pattern dir do?
    – Tim
    Commented Oct 19, 2014 at 22:02
  • as in find foo.sh /? where foo.sh is the file being looked for and / is the directory?
    – jgr208
    Commented Oct 19, 2014 at 22:03
  • It list all the the contents and subcontents of dir here. pattern doesn't matter.
    – Tim
    Commented Oct 19, 2014 at 22:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .