locate command for searching exact filename only

Whenever I use the locate command it shows me all the possible wrap around results; if I am searching for xyz.c, and use locate xyz.c I get

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

what to do if I want exactly xyz.c only ?


Solution 1:

From 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*.

Therefore...

locate -b '\xyz.c'