Читать книгу Linux Bible - Christopher Negus - Страница 162
Finding files by name
ОглавлениеTo find files by name, you can use the -name
and -iname
options. The search is done by base name of the file; the directory names are not searched by default. To make the search more flexible, you can use file-matching characters, such as asterisks (*
) and question marks (?
), as in the following examples:
# find /etc -name passwd /etc/pam.d/passwd /etc/passwd # find /etc -iname '*passwd*' /etc/pam.d/passwd /etc/passwd- /etc/passwd.OLD /etc/passwd /etc/MYPASSWD /etc/security/opasswd
Using the -name
option and no asterisks, the first example above lists any files in the /etc
directory that are named passwd
exactly. By using -iname
instead, you can match any combination of upper- and lowercase. Using asterisks, you can match any filename that includes the word passwd
.