![]() Replace /path/to/search with the directory where you want to begin the search. Searching by file type: find /path/to/search -type file_type Replace /path/to/search with the directory path where the files are located or remove it if you are in the same directory where the file is available. To get more out of the ‘ find‘ command we can use additional options to refine our search results in the Ubuntu terminal. find -name "*.txt" 2: Using the ‘find’ Command with Additional Options Whereas, if you don’t know the exact file name but are aware of the extension it is using then we can list all such files using the wildcard:Įxample: It will list all files of the directory where you are searching with. Replace “ /path/to/search” with the directory where you want to start the search, and “ your-filename” with the name or pattern, or extension of the file you’re searching for.įor example, if you want to search for a file in the terminal let’s say “example.txt” in the current directory and its subdirectories, use: find -name "example.txt" Syntax: find /path/to/search -name " your-filename" Whereas, to search without switching to any folder we have to declare the path of the directory where the files are located in the command. To search in the current directory find -name you-file-name ![]() To use it either switch to the directory where the file you want to search is located or declare the path where you want the “find” command to search for it. We can even define different criteria such as name, type, size, and modification time. ![]() The ‘find’ command is by default available on all Ubuntu Linux systems to search for files directly in the terminal. 4: Using the ‘grep’ Command 1: Seach files using the ‘find’ Command
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |