2.4.1 Search files (find)
We can find which directories hold specified file.
find path -name file_name |
In the file name, you can use character '*' or '?'. '*' means any characters, and '?' means any character.
Let's search the file named hosts under /etc directory.
$ find /etc -name hosts ↵
/etc/avahi/hosts
/etc/hosts
find: /etc/cups/ssl: Permission denied
find: /etc/audit: Permission denied
:
:
|
Under /etc directory, there are some directories which general user can't access. 'find' command tries to find target files from all parts under specified directory. So if necessary, you should grant proper right to its user.
Now, let's search files, such as hosts.allow and hosts.deny, using the wild cards.(In order to avoid errors, it performs by administrator authority)
# find /etc -name hosts.* ↵
/etc/hosts.deny
/etc/hosts.allow
|
We could confirm that we can search with ambiguous file names by using wild card.