How to Find a File by Name Using Command Line in Ubuntu
Answer: Use the
You can use the
find command to find or search for a file in a directory hierarchy.
For example, to find the file named "sample.txt" within the
/var/www you can use:
To search this file within the whole file system you can simply use:
To search this file within the current working directory you can use:
The options have the following meanings:
-type: Search for files based on their type. The descriptor
fspecify a regular file.
-name: Sets the name of the file you are searching for.
Moreover, if you want to search for a directory use the option
Here are some more FAQ related to this topic: