"No such file or directory": using whereis, locate, and find
Ever try to follow a tutorial, but can't find the files referenced? No worries, you don't have to give up on the tutorial and keep Googling for others-- just find the files!
whereis [OPTIONS] FILE_NAME
[user@server ~]$ whereis openvpn openvpn: /usr/sbin/openvpn /usr/lib64/openvpn /etc/openvpn usr/share/man/man8/openvpn.8.gz
This tool will search for a pattern instead of a specific file name.
This tool may need to be installed with the mlocate (or findutils) package:
yum install mlocate
Then ensure you run updatedb before use:
locate [OPTIONS] PATTERN
[user@server ~]$ locate ovpn /usr/bin/gen-ovpn-client /usr/share/doc/openvpn-2.5.2/sample/sample-windows/sample.ovpn
This tool has more options than the others, and can be useful when you have more complex searches.
This tool may need to be installed with the findutils package:
yum install findutils
find [directory to search] [-options] [what to find]
[user@server ~]$ find / -name server.conf /usr/share/doc/openvpn-2.5.2/sample/sample-config-files/server.conf /usr/share/doc/NetworkManager/examples/server.conf /etc/openvpn/server/server.conf
This is a very simple example of find. You can find more complex examples over at Tecmint.
These tools all have different algorithms, and may return different results for the same search. So, if you can't find what you're looking for with one, try another! More info on the differences of locate and find here. Check the man page for whereis for more info on whereis.