
/002_uses-of-linux-command-find-2201100-5bd8f0d64cedfd00264fc4e5.jpg)
If locate is not available, you can use find instead. If file is on the system for more than a day it should already be in the index and this can be skipped

# updatedb # run as root, possibly using sudo, e.g. Locate and its variants tend to be a fast method. The criteria you can tell find to exit after finding the first matching file: find / -iname 'book1*' -print -quit 2>/dev/null I also suggest putting 2>/dev/null at the end of the line to hideĪll *permission denied* and other errors that will be present if you invoke find as a non-root user: find / -iname 'book1*' 2>/dev/nullĪnd if you're sure that you're looking for a single file, and there is only a single file on your system that match
#BASH FIND FILE NAMED FULL#
If you don't know the full filename, capitalization and location indeed you should use something like this: find / -iname 'book1*' Looking for is actually in your $HOME directory if you worked on Third, remember about quoting the pattern as said in the otherĪnd last - are you sure that you want to look for the fileĮverywhere on your system? It's possible that the file you're Then don't use -iname but -name, it will be faster: find / -name 'Book1.gnumeric' You're sure the file you're looking for is called Book1.gnumeric Specify -iname book1 it might also find Book1, bOok1 etc. Second, -iname will make find ignore the filename case so if you Or specify the full name: find / -iname 'Book1.gnumeric' String book1 match Book1.gnumeric you either have to add * so it Gist is that in order for find to actually find a file theįilename must match the specified pattern.

First, an argument to -iname is a shell pattern.
