![]() ![]() This way, you tell the find command to look for type file and with names that end with. cpp, so you can search it like this: find. One of the most common use of the find command is to find files of a specific type or should I say a specific extension.įor example, let's say, you want to search for all the C++ files in the current directories. Screenshot of above three examples: Search files by their extension (important) ![]() You can run a case-insensitive search with the given name by using -iname instead of -name. In the previous file, look for directories only: ab :~/Examples$ find -type d -name mystuffīy default, the find command is case sensitive. If you only want to search for directories, specify type -d: find. Take the previous example and find for files only: :~/Examples$ find -type f -name mystuff The order of type and name does not matter. If you only want to look for files, specify file type -f: find. ![]() The below example finds both file and directories named mystuff: abhi :~/Examples$ find -name mystuff Since there is no file type mentioned, it searches for both files and directories with the given name. You can search for files and directories by its name: find. Let's see some practical examples of the find command. The option -type f asks it to look for files only. This command will run a search in the current directory and its subdirectories to find a file (not directory) named myfile. If you want to find files with name matching a pattern, expression in the pattern. If you want to find a file by its name, expression is the file name.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |