Categories How To

How To Search Files and Folders In Linux Using Find Command.

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.

This post was last modified on September 18, 2013 5:37 pm

Mohsin Raza

Mohsin is the veteran technology content writer at TechBeasts. Mohsin used to write about Android Custom ROMs and Recoveries.

Share
Published by
Mohsin Raza

Recent Posts

Snapchat not working? Here are the top 7 solutions you should try

Snapchat is a popular social sharing platform so when something goes wrong it can be…

2 years ago

Android 12: Details on the CDD arrives – How the performance classes will work

Android 12 Compatibility Definition Document (CDD) calls for device manufacturers to specify the performance classes…

3 years ago

Telegram: Beta 8.0.0 news for Android plus new feed for channels

New features in Telegram Beta 8.0.0 for Android include group video chat 2.0, live video…

3 years ago

Blackout Bingo for PC – Play for free on Windows 10, Mac

Download the Blackout Bingo app on your PC. With a competitive twist to the classic…

3 years ago

Wombo for PC – Use for free on Windows 10, Mac

Download the Wombo app on your PC. All you have to do is add a…

3 years ago

Golf Rival for PC – Play for free on Windows 10, Mac

Download the Golf Rival app on your PC. Follow the steps discussed below to get…

3 years ago

This website uses cookies to provide you up-to-the-mark services.