Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux locate command

Find paths using a prebuilt filename database; results may need updating.

mlocate/plocate

Syntax

Command form
locate [OPTION]... PATTERN...

Common options

6 options
OptionWhat it does
-i, --ignore-caseMatch without case sensitivity.
-b, --basenameMatch only the final path component.
-c, --countPrint the number of matches instead of names.
-r, --regexp REGEXPInterpret the pattern as a regular expression.
-e, --existingPrint only entries that currently exist.
-0, --nullSeparate output paths with NUL characters.

Usage examples

2 examples

Find paths using a prebuilt filename database; results may need updating.

locate ssh_config

Search basenames case-insensitively.

locate -i -b 'readme*'

Notes

locate searches a database that may be stale or unavailable until updated; it is not a live filesystem scan.