Link to home
Start Free TrialLog in
Avatar of davidpm
davidpmFlag for United States of America

asked on

how to use find command

If I'm logged in as root and change to the root directory the following command works as expected:
find -name myfile

If however I do:
find / -name myfile
it lists every directory on the drive.
This second option would be handy so I wouldn't have to switch to the root every time I want to search for a file.

Why does it do that and what should I type/
Avatar of santoshmotwani
santoshmotwani
Flag of Australia image

You syntax is right but it may be possible there are multiple files with the same name

find / -name myfile

Its searching the whole system for any files named  myname and displayign their pathnames.  

You can be more specific about type of files by adding extension to file name or use grep to get only specific files you want
ASKER CERTIFIED SOLUTION
Avatar of torimar
torimar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Steve Tempest
Steve Tempest
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of davidpm

ASKER

Thanks