How you can Discover Out Prime Directories and Information (Disk Area) in Linux

Get real time updates directly on you device, subscribe now.

As a Linux administrator, you could periodically verify which recordsdata and folders are consuming extra disk area. It is rather needed to search out pointless junk and unencumber them out of your onerous disk.

This transient tutorial describes the best way to discover the most important recordsdata and folders within the Linux file system utilizing du (disk utilization) and discover command. If you wish to study extra about these two instructions, then head over to the next articles.

How you can Discover Greatest Information and Directories in Linux

Run the next command to search out out prime greatest directories beneath /house partition.

# du -a /house | type -n -r | head -n 5

Find Largest Directories in LinuxDiscover Largest Directories in Linux

The above command shows the most important 5 directories of my /house partition.

Discover Largest Directories in Linux

If you wish to show the most important directories within the present working listing, run:

# du -a | type -n -r | head -n 5

Find Biggest Directories OnlyDiscover Greatest Directories Solely

Allow us to break down the command and see what says every parameter.

du command: Estimate file area utilization.
a : Shows all recordsdata and folders.
type command : Kind strains of textual content recordsdata.
-n : Examine in response to string numerical worth.
-r : Reverse the results of comparisons.
head : Output the primary a part of recordsdata.
-n : Print the primary ‘n’ strains. (In our case, We displayed the primary 5 strains).

A few of you want to show the above end in human-readable format. i.e you would possibly need to show the most important recordsdata in KB, MB, or GB.

# du -hs * | type -rh | head -5

Find Top Directories Sizes in LinuxDiscover Prime Directories Sizes in Linux

The above command will present the highest directories, that are consuming up extra disk area. For those who really feel that some directories should not essential, you possibly can merely delete a couple of sub-directories or delete the whole folder to unencumber some area.

To show the most important folders/recordsdata together with the sub-directories, run:

# du -Sh | type -rh | head -5

Find Largest Folder and Sub directoriesDiscover Largest Folder and Subdirectories

Discover out the which means of every possibility utilizing in above command:

du command: Estimate file area utilization.
-h : Print sizes in human-readable format (e.g., 10MB).
-S : Don’t embrace the dimensions of subdirectories.
-s : Show solely a complete for every argument.
type command : type strains of textual content recordsdata.
-r : Reverse the results of comparisons.
-h : Examine human readable numbers (e.g., 2K, 1G).
head : Output the primary a part of recordsdata.

Discover Out Prime File Sizes Solely

If you wish to show the most important file sizes solely, then run the next command:

# discover -type f -exec du -Sh {} + | type -rh | head -n 5

Find Top File Sizes in LinuxDiscover Prime File Sizes in Linux

To seek out the most important recordsdata in a specific location, simply embrace the trail beside the discover command:

# discover /house/tecmint/Downloads/ -type f -exec du -Sh {} + | type -rh | head -n 5
OR
# discover /house/tecmint/Downloads/ -type f -printf “%s %pn” | type -rn | head -n 5

Find Top File Size in Specific LocationDiscover Prime File Measurement in Particular Location

The above command will show the most important file from /house/tecmint/Downloads listing.

That’s all for now. Discovering the most important recordsdata and folders is not any large deal. Even a novice administrator can simply discover them. For those who discover this tutorial helpful, please share it in your social networks and help TecMint.

If You Admire What We Do Right here On TecMint, You Ought to Contemplate:

TecMint is the quickest rising and most trusted neighborhood web site for any sort of Linux Articles, Guides and Books on the net. Tens of millions of individuals go to TecMint! to go looking or browse the 1000’s of printed articles out there FREELY to all.

For those who like what you’re studying, please take into account shopping for us a espresso ( or 2 ) as a token of appreciation.

Support Us

We’re grateful in your by no means ending help.

Comments are closed.

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