In Linux, Find Command can help you in finding many apps, folders, files in less time. This utility is capable to find almost everything in your OS including mount drives and removable storage. Mostly only a few commands are necessary to find things for users.
The Format of Find Command is:
find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path…] [expression]
- The H, P and L options specify whether to follow commands.
- debugopts provides debugging information.
- And Olevel provides query optimization.
For your use of find, we will only need to specify the path and expression.
The Path:
The path specify where to look on the filesystem.All the subdirectories and the path will be searched by find. Specify ‘/’ for the path to search the entire filesystem.
Expression:
It consist of 3 parts: OPTIONS, TESTS and ACTIONS.
Now let’s discuss about the OPTIONS.
-help this will print out the short summary of find command usage.
find -help
-mount this option tells find not to search other directories.
Now the TESTS.
This sections tells find what to look for.
-executable This tells find only to search for executable files.
–name/-iname This gives string of the file or folder name you are searching for.
-regex This can be used instead of name to search for file and folder.
-type This can be used to specify what you are looking for.
Finally the ACTIONS.
This section is used to perform actions on the results of find command.
-exec Execute a command on each file found with file/directory name passed of the command.