Searching for Files Print

  • 0

find and locate.

WHAT find DOES

Walks a directory tree and matches files by criteria.

WHAT THE BASIC FORM IS

find, a starting path, then conditions.

WHAT TO SEARCH BY

Name Type, file or directory Size Modification time Owner Permissions

WHY MODIFICATION TIME IS SO USEFUL

It answers what changed recently, which is the first question after a compromise or a breakage.

WHAT AN EXAMPLE QUESTION IS

Which files under this account changed in the last day?

WHAT THE EXECUTE OPTION DOES

Runs a command on each result.

WHY THAT IS POWERFUL AND DANGEROUS

It applies an action to everything matched, and a wrong pattern applies it widely.

WHAT TO DO FIRST

Run the find without the action, and read the list.

WHAT locate DOES

Searches a prebuilt index, very quickly.

WHAT ITS WEAKNESS IS

The index is periodically rebuilt, so recent files are missing.

WHAT which AND whereis DO

Show where a command lives.

WHY THAT MATTERS

Several versions of a program may exist, and knowing which runs explains odd behaviour.

WHAT TO USE FOR LARGE ACCOUNTS

find with restrictions, to avoid scanning the whole disk.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot