Pages

Using find to search files

Looking for something? Find has all the power you’ll need to locate any file or directory on your system, as long as you know the name of what you’re trying to find.

First you’ll need to launch a terminal session, and then we’ll dive into this by typing the following command.

find / -name 'my-file.txt' 2>/dev/null

Breaking down our ‘ find ‘ command

  • ‘ / ‘ - is our search location, since we’re using / it’ll search everything on our root partition

  • ‘ -name ‘ - says we’re gonna search by name, and we can type anything in here (* wildcard)

  • ‘ 2>/dev/null ‘ - will tell the shell to pipe all errors to dev/null meaning they wont be displayed

No comments:

Post a Comment