How To: Find Files Over A Certain Size

Today’s article is going to be a quick article, one where we learn how to find files over a certain size. We’ll be using the ‘find’ command, which we’ve used previously, even though it can be fairly complicated to use. If you want to play around with the ‘find’ command, read on!

Also, and this wasn’t the first article I wrote tonight. I wrote another article. It was a good article. No, it was a great article! Then, as I’m wrapping that article up and hit the preview button, I scrolled down and saw the automatic article recommendation thing at the bottom…

Yup… It was such a good article, I wrote it twice! Well, I couldn’t let that pass – as I’d just done so recently, so I’m writing a new one and this one should be entirely new!

Making the find command approachable to new users means doing it in small bits. Fortunately, the command tells you what it does by its very name. It does exactly what you’d expect – it helps you find files. In fact, it defines itself as:

find – search for files in a directory hierarchy

So, it does what you’d expect it to do – though it can seem fairly complicated to a new user. Let’s do our best to make it approachable, shall we?

Lets Find Files Over A Certain Size:

If you’re a regular reader, you’ll know what’s coming next…

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

So, if you just want to run this ‘find’ command in the directory (and recursive into sub-directories) you’re in, it’s nice and easy. Try this:

As you can guess, that finds files bigger than 100 MB in your current directory (and recursively). If you want to find files of a different size, you just change 100M to whatever you need – like 1000M (you can use G for gigabytes, for example).

If you want, you can specify a directory. Let’s say you want to do the entire system from the root directory (not to be confused with the root user). You just specify that – but you’ll want to use ‘sudo’ because you don’t have permission to read all those files.

Like this, you can specify the starting directory. If you want to find all files larger than 2 GB in your home directory (and sub-directories) then you just run this command:

There’s so much that you can do with the ‘find’ command. It’s really quite useful and I find myself using it with some regularity. Don’t forget to run the man find command to learn more about it. You can do a lot more than just find files over a certain size.

Closure:

So, I’ve tried to make the find command approachable by even novice users. It can be a bit complex looking, but it really is useful. If you think I’ve made it approachable, go ahead and comment. Of course, comment if you think the opposite is true. It’s all good, we’ve just tried to learn how to find files over a certain size.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Find Multiple Filenames By Extension

Today’s article will show you how to find multiple filenames by extension, using the find command in the terminal. It’s a pretty handy skill to have for when you need to know where files of a certain extension reside on your file system.

If you got a new article notification yesterday, that’s because I’m an idiot. Instead of hitting the schedule button, I hit the publish button. I’m not sure what I was thinking. It was fairly early in the afternoon and I wasn’t even sipping wine at the time! Sorry for disturbing you unnecessarily. I almost sent out an ‘oops’ newsletter, but then I’d have just disturbed you twice.

Anyhow, this will be another article that makes use of the find command. The find command is a rather robust command and can be somewhat daunting for new people. I feel more comfortable writing articles that let you learn it in chunks, rather than trying to cover the entire thing. I do find it hard to explain, but I’ll do my best.

What’s this useful for? Well, let’s say you want to find .deb, .zip, and .iso files in you ~/Downloads directory. That’s what this command is going to do for you. You can find multiple filenames by extension in the terminal and it’s not overly complex once you understand the basics of the command.

Instead of making the intro needlessly longer, and to make up for today’s scheduling gaff, I’ll keep the intro short and we’ll just run straight into the article…

Find Multiple Filenames By Extension:

In the intro, I mentioned that this was going to be done in the terminal. As such, we’re obviously going to need an open terminal for this exercise. To do so, press CTRL + ALT + T and your default terminal should open. Tada!

Warning: I do not explain this one as well as I’d hoped. So, I tried to explain by way of demonstrating. I’m hopeful that works.

Now, here’s the command I just ran in my terminal:

Now, if you want to run it in the current directory, you can specify the directory or you can change ~/Downloads to a . (period).

If you want to find just one file, you’d stop after "*.deb" and leave the closing \).  If you want to add additional files, you would include -o -name "*.<extension>" and make sure to keep the closing ).

It might be easier to show you. For formatting reasons, I’ll use the . (period) instead of specifying a directory. It’ll fit on your screen better than a longer command. So, “How To:”…

Find One File By Extension:
Find Two Files By Extension:
Find Three Files By Extension:

So, hopefully you can see how this find command works. I can’t think of a better way to explain the command than to show it to you in examples. I hope that works for people. Feel free to comment in either direction, as I think it might work for some but be less effective for others.

In theory, you could find all sorts of files by extension, just remember to include the -o -name and file type and noting that the asterisk is a wildcard in this instance, meaning all files with that extension will be found. So, .gz files would be "*.gz". You can make the command as long as your heart desires!

Well, no… There’s bound to be an upper limit somewhere. (Wait, I looked it up, the maximum number of characters in the terminal is 4096 characters. And now we know…)

EDIT: You have no idea how much of a pain in the butt this article turned out to be. Holy crap. For safety reasons, WordPress eats the backslash \. I did not know this. Nobody knows this. The solution is to escape the backslash by using it twice. This article is full of backslashes. I think I got them all. It eats them every time I save the draft, so hopefully they show up in publication. I can never edit this article again, so it is what it is. Well, I could edit it again, but it’d be a pain in the butt.

Closure:

So, yeah… Today we’ve learned to find multiple filenames by extension. At least I hope we have. It’s not so easy to explain, but I figured if I explained it by showing examples then you’d be able to pick it up in context. If you do have any questions, just drop ’em into the comment box below and I’m usually pretty speedy at getting back to people. As always, the man page is probably helpful.

Again, sorry about the fake article notification. That doesn’t happen often, but it does sometimes happen. In an ideal world, I’d have an awesome editor and I would just save everything as a draft. If you’re interested in volunteering for that role, let me know! It’d make my life so much easier, I think… I mean, I don’t really know… It just seems like something that’d help.

Also, I’m pretty excited to write this month’s meta article. I’ll probably wait and schedule it for the holiday or a weekend day. They’re not important articles, but I find it interesting. The site’s growing steadily.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

How To: Find Files Owned By A Specific User

In today’s article, we’ll be learning how to find files owned by a specific user. We’ll even use the ‘find’ command, as we find files owned by a specific user! That seems to be the best idea, and the best way to do it.

This should also be a fairly quick article. I don’t see any reason why I’d have to make it longer than it needs to be. So, it won’t take too much of your time today.

This article will be published on November 11. That’s a day known by a number of other names. It’s Veteran’s Day, Armistice Day, Remembrance Day, and probably a dozen more names that I don’t know. It was the day WWI ended, which was thought to be the war to end all wars ’cause it was just that horrific.

Well, as you can see, it was definitely not the last war – but we still choose this day to remember. In the US, veterans are celebrated today. Memorial Day is only for those who are no longer with us. Today is for the vets, as well as those who are no longer here.

It’s a holiday, which means it’s a fine day to have a nice and simple article. It’s a fine day to cherish your friends and family, instead of spending your time online reading Linux articles. (But thanks for doing so!)

Find Files Owned By A Specific User:

This article requires an open terminal, like so very many other articles. If you don’t know how to open the terminal, you can do so with your keyboard, just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, you should probably navigate to a directory other than your home directory. If you run this command in your home directory, it’s gonna output a whole lot of text. So, let’s just try this first in your ~/Downloads directory:

The command we’re going to use is find, and the format is the find command, a dot to say the current directory, the -user flag, and then the username. So, your command would look something like:

(No brackets, of course.)

You probably don’t have any files owned by root in that directory, so a good test to make sure it’s working properly would be something like:

Now, you can mix things up a bit. Instead of using the dot to indicate the current directory, let’s find files owned by root in the /etc directory.

See? That’s not all that hard at all. It’s remarkably easy to find files owned by a specific user – and the command really isn’t that hard to memorize! You can run it in the folder you’re in, or you can use the directory path method.

Closure:

I told you that it’d be a quick article today. It’s a good day for just a quick tip and everyone can benefit from knowing how to find files owned by a specific user. Toss this tip into your growing list of tools in your Linux toolbox, because  you never know when this will come in handy.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Find Files Modified On A Specific Day

In today’s article, we’re going to do exactly what the title says, we’re going to find files modified on a specific day. Imagine that! We’re doing what it says in the title! I dunno why I write the things I do. But, I do have quite a few people reading, and hardly any of ’em complain!

So, why would you want to do this? Well, let’s say Big Bad John logged into your system on Friday. He was fired for drinking at lunch, but still had access to the system for another hour before security got around to hauling his butt out of the building.

Wouldn’t you like to know what files were changed on his computer that day, just to see if he’d done anything malicious? You might also have some weird system errors and want to know what files have changed today so that you can narrow down your search for the culprit. There are all sorts of reasons why you might want to know how to find files modified on a specific day.

We’re going to be using a simple command, and just one command. We’ll be using the ‘find’ function. There are surely other ways to do this, but we’ll use the find command. It works and it means you have a relatively short article.

How To: Find Files Modified On A Specific Day:

This article requires an open terminal, like many other articles on this site. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, let’s say you want to find files edited on the day this article is published. To do that, you’d run this command:

For the sake of simplicity, the format is YYYY-MM-DD. You could use other date formats that are recognized by the system, but we’ll just stick to this date format as it’s nice and easy.

Now, you can also adjust your ‘maxdepth‘ value. If it’s a 1, it will dig down one directory deep. So, if you’re in your home directory, it’ll dig into ~/Downloads, ~/Pictures, ~/Documents, etc… If you change it to 2, it’ll dig into the sub-directories, like ~/Downloads/foo and ~/Documents/bar.

If you want to find files modified on a specific day, simply change the date in the command and start searching. It’s handy if you edited a file and can’t recall which file it was you edited. The command can be used for all sorts of things like that. Good luck!

Closure:

There you go… You have another article and this one teaches you how to find files modified on a specific day. It’s a short article with just one command. There’s no reason to pad the article further. It’s just the one command. Thanks for reading!

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.