Linux locate command: Find Files and Directories Quickly and Efficiently

terminal-logo-smallThis is quick guide howto find files and directories quick and efficiently on Linux with locate command. Linux find command is outdated, slow and complicated to use, so locate command is much better option.

Locate basic usage find files and directories

locate file
# example
locate httpd.conf
 
locate path
# example
locate /X11/

Find (locate) ignore-case (not case sensitive)

locate -i file
# example
locate -i netbeans

Find (locate) only file name (basename)

locate -b file
# example
locate -b shadow

Limit locate output

locate -l 100 file
# example
locate -l 50 conf

Print number of found entries

locate -c file
# example
locate -c conf

Print number of found entries

locate -c file
# example
locate -c conf

Print locate statistics

locate -S

Print number of found entries

locate -c file
# example
locate -c conf

Find (locate) with full file info

Simply locate something and pipe output to ls command.

locate file |xargs ls -lah

Want to know even more

Check help and manual

locate --help
man locate

Related posts:

  1. Delete files permanently with shred command in Linux – Remove absolutely Sometimes need to delete files whose contents should disappear absolutely, completely and safely. Linux command rm just remove file and...
  2. Linux Tip: How to handle a files with a dash as first character from command line Sometimes you maybe have to handle files with a dash (-) as first character from Linux command line. It can...
  3. Google search from Linux and UNIX command line Today I started thinking that how cool is do some Google searches straight from command line. First I try to...
  4. Delete files securely on Linux – Journaled file systems Few days ago I write about shred, which work fine for old systems, like EXT2, but not so nice with...
  5. Linux: Enable Laptop Touchpad Vertical Scrolling and Tapping from Command Line I noticed that the Fedora Linux with KDE desktop, has reasonably poor support for laptop touchpad adjustment. For example, the...

About the Author

Hi, I'm JR and the Founder of if not true then false. I am a software developer, and I have over ten years experience in programming. I'm big fan of Linux and Open Source. And normally I use just Linux environments.

Like If (!1) 0 on Facebook: