
To understand and use find for many other vital command line operations, you can read our article below. In this guide, we covered a simple yet helpful find utility trick to enable us find multiple filenames by issuing a single command. To find files with exactly the provided search pattern, use the -g (or -glob ). When you critically observe all the commands above, the little trick is using the -o option in the find command, it enables you to add more filenames to the search array, and also knowing the filenames or file extensions you are searching for. The command name is 50 shorter than find :-). The basic syntax for find is straightforward: find PATH OPTIONS EXPR By default, the path is the current directory.
#Linux find file by name pdf
pdf extensions: # find /home/aaronkilik/Documents/ -type f \( -name "*.png" -o -name "*.jpg" -o -name "*.deb" -o -name ".pdf" \)įind More than 3 File Extensions in Linux Here is another example where we search for files with. c extensions, issues the command below: # find. The aforementioned command will search for a file named filename. To find all the files more than 1MB, use the + sign. To find a file using the filename, use the -name flag with the default command. Notice the - symbol before the size value: find. In the example below, we search for all less than 1MB files in the current working directory. Find a File in Linux by Name or Extension Use find from the command line to locate a specific file by name or extension. It is recommended that you enclose the file extensions in a bracket, and also use the \ ( back slash) escape character as in the command.Ģ. The find command allows you to search for files based on their size. -name option is used to specify a search pattern in this case, the file extensions.

-type option is used to specify file type and here, we are searching for regular files as represented by f.type f \( -name "*.sh" -o -name "*.txt" \)įind. fileparts interprets the entire file name as an extension because it begins with a period. txt file extensions, you can do this by running the command below: # find.


Assuming that you want to find all files in the current directory with. Let us proceed to look at some examples of find command in Linux.ġ.
