Sometimes you might need to search for specific file types such as regular files, directories, or symlinks. For example, to find all files that don’t end in *.log.gz you would use: find /var/log/nginx -type f -not -name '*.log.gz' Find Files by Type # To find all files that don’t match the regex *.log.gz you can use the -not option. It is important to mention that you must either quote the pattern or escape the asterisk * symbol with backslash \ so that it doesn’t get interpreted by the shell when you use the wildcard character. log.gz inside the /var/log/nginx directory, you would type: find /var/log/nginx -type f -name '*.log.gz' For example, to find all files ending with. Searching for files by extension is the same as searching for files by name. The command above will match “Document.pdf”, “DOCUMENT.pdf”. To run a case-insensitive search, change the -name option with -iname: find /home/linuxize -type f -iname document.pdf Find a file using filename in macOS Terminalįor example, to search for a file named document.pdf in the /home/linuxize directory, you would use the following command: find /home/linuxize -type f -name document.pdf
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |