Connect with us

Hi, what are you looking for?

Latest

How to Find the 10 biggest files on Linux Command Line

This short tutorial will show you how to find the largest files on your Linux machine using some commands you may already know: du, sort and head.

To find the 10 largest files and folders in the current directory:
of -h | sort -hr | header -n 10

To find the 10 largest files and folders in the current directory:
of -ah | sort -hr | header -n 10

Read the rest of this article for a detailed explanation of these commands.

The command is used to obtain information about the use of the player. With the sort command you can sort the data as required. The Header command displays the top lines of the text input source.

It’s just a combination to get the largest files and folders on the Linux command line. There may be several other ways to achieve the same result.

How do I find the largest files under Linux?

How to Find the 10 biggest files on Linux Command Line

What happens if you merge three teams without options? Your result probably won’t be very useful.

When these commands are executed, unless specified in du, everything is executed automatically, using the current working directory as the source file.

When sorting without options, items are sorted in numerical order, but this behavior is a bit strange. 100 is considered less than 12 because 2 > 0. That’s certainly not what we want.

The first 10 points are displayed by default. Depending on the folder you want to scan, you can configure it to quickly find large files.

[email protected]:~$ you | sort | head100 ./.local/share/evolution/addressbook108 ./.mozilla/firefox/jwqwiz97 .default-release/datareporting112 ./.local/share/gvfs-metadata12 ./.mozilla/firefox/jwqwiz.cache/fontconfig12 ./.cache/gnome-software/screenshots/112×6312 ./.cache/thumbnails/fail12 ./.config/dconf12 ./.config/evolution12 ./.config/gnome-control-center/background12 ./.local/share/gvfs-metadata12 ./.

Addition of options

So let’s see what could be a more typical option.

The Add -n command for sorting means that items are sorted numerically. The addition of -r means that the results are reversed. That’s what we want when we’re looking for most people.

I would also like to add -5 to limit our results further than the main goal. You should set this value based on what you know about the system.

You can extend the value to a number greater than 10, or omit it altogether if there are many large files you are trying to filter. Otherwise, you can run it and delete some files, but you will still have space problems.

Okay, let’s get this straight and see what happens.

[email protected] manual:~$ you | sort -nr | head -5
1865396 .
1769532 ./documents
76552 ./.cache
64852 ./.cache/mozilla
64848 ./.cache/mozilla/firefox

It’s better, you can quickly see where the largest files are. But you can do better. Let’s look at some other options.

Human performance

Human capabilities for specific teams help to present the figures in a familiar way. Let’s try to add him to your team.

[email protected] Handbook:~$ du -h | sort -nr | head -5
980K ./.local/share/app-info
976K ./.local/share/app-info/xmls
824K ./.cache/thumbnails
808K ./.cache/thumbnails /large
804K ./.local/share/tracker.

Corrected output of human reader

Wait a minute, wait a minute… These numbers make no sense. No, that’s not true, because you’ve only changed the content so the duo’s team can read it. Sorting has its own built-in function that enables people to sort digitally with -h. Both methods must be used to achieve the desired result. This kind of problems can often occur under Linux.

It is important to experiment and make sure that your results are meaningful before you use the control in any way.

Let’s try again.

[email protected] manual:~$ du -h | sort -hr | head -5
1.8G.
1.7G ./Documents
75M ./.cache
64M ./.cache/mozilla/firefox/jwqwiz97.default-release
64M ./.cache/mozilla/firefox

That’s more like it.

Where are the largest files located?

You can tell from the output that the Documents folder contains several large files, but if you go to this folder and execute our command again, you won’t get the largest file. You’ll get it:

[email protected] manual:~/Documents$ du -h | sort -hr | head -5
1.7G .

He’s only telling us what you already know. The current directory named . contains 1.7G files. There’s no point in trying to find some unusually large files.

To do this, you need to add another indicator. With option -a, you can get the number we’re looking for. Let’s give it a try.

[email protected] manual:~/Documents$ du -ah | sort -hr | head -5
1.7G .
1.1G ./1gig-file.file
699M ./doc.tar
2.9M ./photo of female rhino top-2777898.jpg
1.4M ./ bright laptop-2047905.jpg

Conclusion

Did you like this guide to finding large files under Linux? I hope you’ve learned something new from all this advice.

If you like this guide, make it available on social networking sites. If you have any comments or questions, please leave them below.

How to Find the 10 biggest files on Linux Command Line

Christopher Murray

Christopher is a software developer in Orlando, Florida. He likes open source, Taco Bell and Chi-weeney named Max. Visit his website for more information or contact him via social media.

Did you like the article? Share with us and help us grow 🙂how to find large files in linux in / file system,linux find large files exclude directory,find largest files linux human readable,linux find files larger than 1gb,linux find largest directories recursively,check 10 biggest files linux,linux command to get large files,terminal find largest files

You May Also Like

Hosting

Introduction In previous articles we have talked about images of dockers, the origin and functioning of dockers and the dockers’ hub. In this document...

Latest

Linux desktops are good in many ways, but like Windows they are not known as the most efficient battery. This does not mean that...

Latest

The United States Supreme Court has indicated that it will finally solve a problem that has been causing legal problems for almost two decades:...

Hosting

To secure your AWS assets, follow these AWS Identity and Access Management (IAM) guidelines. Locking the Root User Access Key for AWSAccount You use...