How To Find Large Files Using Command Line In Linux

find large files using command line in linux

The Linux command line is a pretty powerful tool. You can do pretty much anything with it. Today, we will look at finding large files with command. We are going to use a command called “find”. It has been around for many decades and for a good reason. It does its job extraordinarily well. Now, Let’s see the working of this command and how to use it for finding large files.

How To Find Large Files Using Command Line In Linux

find’ command

The syntax of this command goes like this :
$ command directory -test pattern
We will replace “command” with find. The “directory” should be replaced with the directory path that you want to be searched for. You can specify multiple directories too.  “Test” means a condition which the files should match. The most common test we use names. We specify a name and search for the files of the name. An example of the name test is –
$ find ~ -name foo

find command in linux

This command will search for files name “foo” (case sensitive) in the ~ (home directory of the user). You can also search for multiple directories. For example –
$ find ~ /media/user -name foo
This command will search for the files named “foo” in the home directory of the user as well as in the “/media/user/” path ( usually where all the other partitions are mounted).
Note:- Replace user with your username.

You can use wildcards too for patterns. Just don’t forget to use the double quotes around the pattern or name with wildcards to suppress expansion.

Now, there is a test called size. This is used to find files on the basis of their sizes.

$ find ~ -size 10M
This command will show you files that are exactly 10 MB, and I don’t think it will be much useful as people can remember the exact file names. That is why we use –
$ find ~ -size +10M

find file size in command line

This command will show all files above 10 MB. You already guessed how to search for large files now. It depends on what size you call large. If you need to use GB, then, simply replace “M” with “G”.
$ find ~ -size +3G

find file size in command line in linux

This command will search for files above 3 GB.I know that meaning of large varies over contexts. For example, large is different for images and movies. Images are around 1 or 2 MB. But videos don’t practically exist around that size. So, combine the size and name tests.

$ find ~ -size +10M “*.m4a”

find file size in command line with file format

Replace m4a with any extension of your choice.


Now, you can search files with command line on Linux. Just remember that command line is very powerful and find command is one of the basic tools. So, you can expect it to be really flexible and robust. Find has a lot more options which you can find in its man page.

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. AcceptRead More