Finding a file on disk under Linux

Looking for the full file name

It is possible to quickly find a file under Linux (or Ubuntu) thanks to the locate command. This command does not analyse each file on disk but search in a database containing all the file names. The first thing to do is to update the database with the following command:

sudo updatedb

Once the database is updated, the locate command will search for a given file:

locate filename

For examples:

locate stdio.h


locate stdio

Looking for the partial filename

When the file name is not fully known, it is possible to search for with the folowing command:

locate -b PartialFileName*

Leave a Reply

Your email address will not be published. Required fields are marked *