Latest web development tutorials

Linux slocate command

Linux command Daquan Linux command Daquan

Linux slocate command to find a file or directory.

slocate itself has a database, which holds the information about the system files and directories.

grammar

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

Parameters:

  • -d <directory> or --database = <directory> Specify the directory where the database resides.
  • -u update the slocate database.
  • --help displays help.
  • --version display version information.

Examples

Using the command "slocate" displays the file name contains the keyword "fdisk" file path information, enter the following command:

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

After executing the above command, the output instruction is executed 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 command Daquan Linux command Daquan