![]() I also have articles on searching Linux text files with find and grep, and an article on how to grep multiple patterns, which uses a similar approach to this article to search for multiple text patterns. If you're looking for other uses of the find command, check out my Linux find command examples page. The find command searches for a certain file name on the local hard drive. I hope these examples of how to use the Linux find command to find multiple filenames (filename extensions) with one command has been helpful. Any file saved on your Ubuntu 22.04 system can be traced using the find command. ![]() Linux find multiple filename extensions - Summary Those find command options aren't always necessary, so I thought I should mention them. name : Sets the name of the file you are. I just tested this on a MacOS system, and it worked fine.įWIW, note that in these examples I keep using ".", which means "look in the current directory, and anywhere beneath here", and "-f", which means "only look for files, not directories". Answer: Use the find Command -type : Search for files based on their type. type f \( -name "*cache" -o -name "*xml" -o -name "*html" \) To help you see how to expand this from finding two filename patterns to finding even more filename patterns with one find command, here's an example of how to search for three different files extensions with one find command:įind. Linux find multiple filenames command: finding three filename extensions I've tested this 'find multiple' command on several Unix systems, and it should work on all systems that support the Bash shell, including vanilla Unix, Linux, BSD, freeBSD, AIX, Solaris, and Cygwin. If you’re familiar with common Linux find commands, the only magic here is (a) using the "-o" option to say "or", and (b) escaping the parentheses with the backslash character. Here's a Linux find command that shows how to find multiple filenames at one time, in this case all files beneath the current directory ending with the filename extensions ".class" and ".sh":įind. Linux find multiple filenames command - two filename patterns In short, the solution is to use the find command's "or" option, with a little shell escape magic. You can use the Linux find command to find multiple filename patterns at one time, but for most of us the syntax isn't very common. Copy the template configuration file youll find in the root directory of. ![]() ![]() Unix/Linux find command FAQ: How can I write one Unix find command to find multiple filenames (or filename patterns)? For example, I want to find all the files beneath the current directory that end with the file extensions ".class" and ".sh". Running redis-cli followed by a command name and its arguments will send this. ![]()
0 Comments
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |