How to find files using the terminal in Ubuntu

Use the command:
locate "filename"

This will search a daily updated database for the file. Note that newly added files (added after the last database update) will not be included in the search. for direct file system search, use find

locate will search for a any filename containing the phrase “filename”; filename1 & ourfilename will BOTH be listed! to be more specific, use wild cards. locate *.txt will only list filenames that end with a “.txt” postfix.

A practical way to use locate is to use it with “less”: locate filename | less

See manpages: locate(1) for more details.

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: