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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. mount Command Examples in Linux
  2. How to remove unwanted entries in /etc/shadow file
  3. minicom Command Examples in Linux
  4. ln Command Examples in Linux
  5. jasmine-node: command not found
  6. How to use sudo to allow a non-root user run a particular command
  7. Installing Security Vulnerabilities with yum on CentOS/RHEL 5,6,7 (Cheat Sheet)
  8. lastcomm: command not found
  9. elinks Command Examples in Linux
  10. “Warning: Missing charsets in String to FontSet conversion” – how to resolve the xclock warning message

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright