1. 程式人生 > >Liunx find/locate/whereis/which 總結

Liunx find/locate/whereis/which 總結

對比 包括 文件查找命令 庫文件 updatedb 文件查找 數據庫文件 文檔 idt

一、locate 命令

  • 是一個文件查找命令,命令所屬軟件包 mlocate
  • 不同於 find 命令的是,find命令在整塊磁盤中搜索;而 locate命令 在數據路庫文件中搜索,當天創建的文件第二天才會被定時任務處理,添加到數據庫文件中。
  • find 命令默認是 精準匹配文件名;locate是模糊匹配(包括匹配目錄名)

如果想將當前創建的文件立即添加到 數據庫文件中,那麽就是用 updatedb命令

  用戶更新 /var/lib/mlocate/mlocatedb.conf

  所使用配置文件為 /var/lib/updatedb.conf

二、whereis 命令

  -b  只返回二進制文件

  -m  只返回幫助文檔

  -s  只返回源代碼文件

三、which 命令

作用:僅用於查找二進制程序文件

  -b  只返回二進制文件

四、命令對比

  技術分享圖片

Liunx find/locate/whereis/which 總結