In order to successfully find a directory/folder or a file in Ubuntu, you can easily use the
find /where-to-look -type d -name /what-to-look
-type, helps us specify the type of search we’re executing: for a file or a directory?
Below, there is a practical command example where we search inside the /etc folder for a directory called data:
find /etc -type d data
As you might’ve guessed, the
f letter stands for file which helps us do our search by file names. Below, we’re verifying the existence of the file called hosts, inside the /etc directory:
find /etc -type f hosts
-name we can easily specify our search term, a file or a directory.