which

which会在PATH环境中搜寻可执行文件

Linux中的which whereis locate

 

 

whereis

Linux会将系统里面所有的文件都搜集到一个数据库文件中,whereis从这个数据库文件里面寻找文件

Linux中的which whereis locate

 

 

locate

locate的使用很简单,直接在命令后面输入文件名或者部分名称,就能得到结果。locate和whereis一样,也是在数据库文件里面查询。

Linux中的which whereis locate

 

 那么这个数据库在哪里呢?答案就是/var/lib/mlocate。

由于whereis和locate都在数据库里面搜索,而Linux数据库会每天升级一次(根据Linux的发行版本不同,升级时间也不一样),因此你可能会搜到已经被删除的文件、或者新创建的文件却搜索不到的情形。

相关文章:

  • 2021-07-27
  • 2021-09-28
  • 2022-12-23
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-03
  • 2021-07-08
  • 2022-02-03
  • 2021-10-11
  • 2021-07-01
  • 2022-12-23
  • 2021-11-28
相关资源
相似解决方案