Linux slocate Command

Linux 命令大全Linux Command Reference

The Linux slocate command searches for files or directories.

slocate itself has a database that stores information about files and directories in the system.

Syntax

slocate [-u][--help][--version][-d <目录>][查找的文件]

Parameters:

  • -d<directory> or --database=<directory> Specifies the directory where the database is located.
  • -u Updates the slocate database.
  • --help Displays help.
  • --version Displays version information.

Examples

Use the command "slocate" to display the path information of files whose names contain the keyword "fdisk". Enter the following command:

$ slocate fdisk #显示文件名中含有fdisk关键字的文件的路径信息 

After executing the above command, the output is as follows:

$ slocate fdisk #显示文件名中含有fdisk 关键字的文件的路径信息  
/root/cfdisk        #搜索到的文件路径列表  
/root/fdisk  
/root/sfdisk  
/usr/include/grub/ieee1275/ofdisk.h  
/usr/share/doc/util-Linux/README.cfdisk  
/usr/share/doc/util-Linux/README.fdisk.gz  
/usr/share/doc/util-Linux/examples/sfdisk.examples.gz  

Linux 命令大全Linux Command Reference

Other Extensions