仅用于搜索精确文件名的定位命令

仅用于搜索精确文件名的定位命令

每当我使用该locate命令时,它都会向我显示所有可能的环绕结果;如果我正在搜索xyz.c,并使用,locate xyz.c 我会得到

/../../../abc_xyz.c
  /../../../xyzabc_gvdvd.c
  /../../../abcxyz.c
 /../../../xyz.c

如果我仅想要该怎么办xyz.c

答案1

man locate

EXAMPLES
   To search for a file named exactly NAME (not *NAME*), use
          locate -b '\NAME'
   Because \ is a globbing character, this disables the implicit  replace‐
   ment of NAME by *NAME*.

所以...

locate -b '\xyz.c'

相关内容