On the man page for locate, the description could not be more fitting: locate - find files by name. The locate command is installed by default on your Ubuntu machine and the basic functionality is as simple as using locate <filename>. Let's see how this works:
reader@ubuntu:~$ locate fstab
/etc/fstab
/lib/systemd/system-generators/systemd-fstab-generator
/sbin/fstab-decode
/usr/share/doc/mount/examples/fstab
/usr/share/doc/mount/examples/mount.fstab
/usr/share/doc/util-linux/examples/fstab
/usr/share/doc/util-linux/examples/fstab.example2
/usr/share/man/man5/fstab.5.gz
/usr/share/man/man8/fstab-decode.8.gz
/usr/share/man/man8/systemd-fstab-generator.8.gz
/usr/share/vim/vim80/syntax/fstab.vim
reader@ubuntu:~$
In the preceding example, we looked for the filename fstab. We might have remembered that we need to edit this file for filesystem changes, but we were not sure where we could find it. locate presented us with all locations on disk which contain fstab. As you can see, it does not have to be an exact match; everything that contains the fstab string will be printed.
Locate has some options, but in our experience, you only use it if you know the exact (or an exact part of the) filename. For other searches, defaulting to the find command is a much better idea.