Many of you fellow Ubuntu users will be familiar with the “Search for Files” tool that allows you to look for files. As is true with most things in Linux, there are great desktop tools, but more power can be found in Terminal than any streamlined desktop tool can match.

Today, I’d like to introduce you to a few tools that can turn a chore of finding files into an easy process.

 

locate

The first tool that you should become comfortable with is also one of the simplest. The locate program works in a similar fashion to most graphical search tools.

Using

Let’s say that you’ve read up on how to modify X to provide enhanced video performance. The document that you are reading says to modify the xorg.conf file, but the document doesn’t say where that is and you don’t know how to find it. You can use locate to find it for you quickly:

locate xorg.conf

Most likely, your system will return a number of results. For example, on one of my systems, I receive the following output:

/etc/X11/xorg.conf

/usr/share/man/man5/xorg.conf.5.gz

/var/lib/x11/xorg.conf.md5sum

/var/lib/x11/xorg.conf.roster

It’s clear that /etc/X11/xorg.conf is the file we’re looking for, but what if dozens or even hundreds of results were returned? How could you manage all of that? If you know a little bit about regular expressions (every Linux user really should learn the basics), you can easily use regular expressions to search for directories or files. For example, we can search for an exact match for xorg.conf with the following command:

locate -r '/xorg.conf