• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

slocate command in linux

by admin

slocate command is Security Enhanced version of GNU locate. This command searches a database listing every file on the system; it is intended as a faster replacement for “find / -name pattern”. This version stores file permissions and ownership, in order to prevent unauthorized access to files.

locate and slocate consult database files about the system (usually compiled and updated by a job run from the scheduler system cron) to find files or commands almost instantly. The location of the actual database files, what is indexed therein, and how often it is checked may vary from system to system. Consult your system’s manpages for details. slocate (secure locate) stores permission information (in addition to filenames and paths) so that it will not list programs to which the user does not have access. On most Linux systems, locate is a symbolic link to slocate; other systems may have separate programs, or may not have slocate at all.

Syntax:

$ slocate [parameter] [search-string]

slocate Command Options

Option Description
-c Read /etc/updatedb.conf when updating the database.
-dfile, –database=file Use file as the database to search.
-edir1[,dir2…] Exclude the given directories from the database.
-ffstype1[,fstype2…] Exclude files on filesystems of the given types (e.g., NFS).
-h, –help Print an option summary and exit.
-i Ignore case when searching.
-l level Security level. If level is 0, no security checks are done, providing faster searches. The default is 1, which turns on security checking.
-n count Do not print more than count results.
-ofile, –output=file Use file as the database to create.
-q Do not print error messages (quiet mode).
-rregex, –regexp=regex Use the Basic Regular Expression regex to search the database.
-u Create the database starting at /.
-U dir Create the database starting at dir.
-v, –verbose Display filenames when creating the database.
-V, –version Print version information and exit.

slocate Command Example

Use the command “slocate” to display the file path information with the keyword “parted” in the file name:

# slocate parted

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : How to assemble a software RAID in Rescue mode
  2. lspath Command Examples
  3. gunzip Command Examples in Linux
  4. CentOS / RHEL : How to remove used Physical Volume(PV) from Volume Group (VG) in LVM
  5. Time to live exceeded ping error
  6. rkhunter: command not found
  7. cpufreq-set Command Examples in Linux
  8. pacdiff Command Examples in Linux
  9. Search XML Attributes PowerShell XPath
  10. ctags: Generates an index (or tag) file of language objects found in source files for many popular programming languages

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright