Finding things in Linux

Finding things in Linux

Finding things in Linux is not complicated once you know a few commands. First let’s look at the find command and see what it has to offer.

Let’s say you are looking for anything named Linux in your home directory.

This would give you anything named Linux. But it is case sensitive so it wouldn’t give you “linux”. To do that you could type:

You can also use the wildcard (*) to look for types of files. For instance looking for .jpg files in your pictures file.

If you want a certain size of .jpg file you can further narrow it.  This time I am looking for files that are larger than 7 Megabytes.

You can also use the not (!) operator to find files that are not larger than 7 Megabytes.

You can also search files by their owner. For example, I want to find all of the files owned by Root. I would type in:

You can also search files by group:

The find command is very powerful and searches in real-time.

Locate something

Like find, locate will also help you to search files by their name.  It does this by searching a database of files that it updates daily. The advantage of locate is that it is much faster than the find command, but the database may be out of date when you use it to search for a recent file .

This would give you a list of anything named backup and it is case insensitive.  Now, if you were looking for .jpg files in your pictures file you would type:

As I mentioned locate searches have a database and you can update the database by typing in:

 whereis it?

When you need to find the path to an executable program, sources and the man page, the whereis command is a big help.

Conclusion

Searching and finding what you want on Linux just involves a few commands. Once you have these in your “tool kit” you can search and find what you want easily. Don’t forget to check out the man pages on each of the commands that I mentioned, I just scratched the surface of what some of the commands are capable of.

 

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 8

No votes so far! Be the first to rate this post.


Leave a Reply

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


Updated on October 28, 2021

Pixelated Dwarf