It is very common to try to find a file on our hard disk or within a directory and sub-directories. We can easily do that with the find
command in Unix/Linux. Let’s say that I am looking for file names that contain the word report.
find . -iname "*report*"
Notice that the .
refers to our current directory, we could have used the path explicitly like /home
, the -iname
will make find
ignore the filename case, if you want to be case sensitive, you should use the -name
and the *
within the quotes refer to any character, so in essence, we are looking for file names that contain the substring report.
Regarding the Wildcard Characters which are useful for searching:
*
Zero or more characters?
Any one character[]
Any character in the brackets