How to Find a File by Name Using Command Line in Ubuntu

For example, to find the file named “sample.txt” within the /var/www you can use:

find /var/www -type f -name sample.txt

To search this file within the whole file system you can simply use:

find / -type f -name sample.txt

To search this file within the current working directory you can use:

find . -type f -name sample.txt