• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

How to find the largest File/Folder on Linux

AnonyViet by AnonyViet
March 23, 2023
in Network
0

If you are using Linux, you will probably encounter a situation where your hard drive is taking up space, but you do not know which files or folders are heaviest to find and delete. On Linux, there are commands available to help you find the largest File/Folder. With a combination of 3 commands du, sort and head will help you quickly list out the data that is taking up hard drive space on your Linux or VPS.

Join the channel Telegram belong to AnonyViet ???? Link ????
  1. Command du: determine the amount of usage
  2. Command sort: sort the lines of the text file or input data
  3. Command head: output data from the top, for example take the first 10 lines for example

Check the size of the folder /home/ If you want to check the size of the root directory, change it to /root/

du -sh /home/

Use the command below to find the 10 largest files/folders. Replace /home by the path you want

du -a /home/ | sort -n -r | head -n 10

Output example:

589700 /home
589696 /home/anonyviet.com
526988 /home/anonyviet.com/public_html
506628 /home/anonyviet.com/public_html/wp-content
385096 /home/anonyviet.com/public_html/wp-content/uploads
179988 /home/anonyviet.com/public_html/wp-content/uploads/2014
117072 /home/anonyviet.com/public_html/wp-content/uploads/2013
74212 /home/anonyviet.com/public_html/wp-content/plugins
47296 /home/anonyviet.com/public_html/wp-content/uploads/2012
43100 /home/anonyviet.com/public_html/wp-content/cache

If you want to change the capacity bytes wall MB, KB billionthen use the following command:

cd /home
du -hsx * | sort -rh | head -10

The above commands can only be used when Linux has the package installed sortotherwise you can use the command below:

for i in G M K; do du -ah | grep [0-9]$i | sort -nr -k 1; done | head -n 11

Output example:

179M	.
84M	./uploads
57M	./images
51M	./images/a
49M	./images/abc/2013
47M	./uploads/def
37M	./videos/gha/2013/12
37M	./videos/gha/2013
37M	./videos/gha
36M	./videos
35M	./uploads/gha

Command to find the largest files in a folder:

Find the largest file in Folder /home

find /home -printf '%s %p\n'| sort -nr | head -10

Find the largest file in the current folder

find . -printf '%s %p\n'| sort -nr | head -10

Output example:

5700875 ./images/faq/2023/11/iftop-outputs.gif
5459671 ./videos/faq/2023/12/glances/glances.webm
5091119 ./videos/faq/2023/12/glances/glances.ogv
4706278 ./images/faq/2023/09/cyberciti.biz.linux.wallpapers_r0x1.tar.gz
3911341 ./videos/faq/2023/12/vim-exit/vim-exit.ogv
3640181 ./videos/faq/2023/12/python-subprocess/python-subprocess.webm
3571712 ./images/faq/2023/12/glances-demo-large.gif
3222684 ./videos/faq/2023/12/vim-exit/vim-exit.mp4
3198164 ./videos/faq/2023/12/python-subprocess/python-subprocess.ogv
3056537 ./images/faq/2023/08/debian-as-parent-distribution.png.bak

To display only files, not folders, use the command:

find /path -type f -printf '%s %p\n'| sort -nr | head -10

or

find /path -type f -iname "*.mp4" -printf '%s %p\n'| sort -nr | head -10
  • Find the largest directory in Linux
  • Find the heaviest directory in Linux
  • Find the largest folder in Linux
  • Find the heaviest folder in Linux
  • Find the largest file in Linux
  • Find the heaviest file in Linux

Reference: hocvps.com

Rate this post

Tags: FileFolderFindlargestLinux
Previous Post

How to Sign Up and Use the Google Bard

Next Post

How to create USB Boot, USB install Windows with Rufus

AnonyViet

AnonyViet

Related Posts

Cách hạn chế Synology NAS bị Ransomware .L0CK3D: Cách khắc phục
Network

Cách hạn chế Synology NAS bị Ransomware .L0CK3D: Cách khắc phục

October 30, 2026
Instructions for updating PHP to avoid PHP2Shell
Network

Instructions for updating PHP to avoid PHP2Shell

October 22, 2026
Instructions for detecting network vulnerabilities: How to check the system for data leaks (IP/DNS)
Network

Instructions for detecting network vulnerabilities: How to check the system for data leaks (IP/DNS)

October 9, 2026
Is Renting a Cheap VPS to Run Docker Really Effective?
Network

Is Renting a Cheap VPS to Run Docker Really Effective?

July 2, 2026
How to get a free domain for 1 year from Gravatar
Network

How to get a free domain for 1 year from Gravatar

June 23, 2026
Cloud Infrastructure Resilience: Mitigating Advanced Layer 7 Vulnerabilities and Securing High-Throughput Database Handshakes
Network

Cloud Infrastructure Resilience: Mitigating Advanced Layer 7 Vulnerabilities and Securing High-Throughput Database Handshakes

June 20, 2026
Next Post
How to create USB Boot, USB install Windows with Rufus

How to create USB Boot, USB install Windows with Rufus

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted

Recent News

Instructions for receiving Avira Prime 3 months for free, no credit card

Instructions for receiving Avira Prime 3 months for free, no credit card

October 31, 2026
Instructions for cleaning LG TV with Antigravity to help it run faster

Instructions for cleaning LG TV with Antigravity to help it run faster

October 30, 2026
Cách hạn chế Synology NAS bị Ransomware .L0CK3D: Cách khắc phục

Cách hạn chế Synology NAS bị Ransomware .L0CK3D: Cách khắc phục

October 30, 2026
Instructions for installing CleanYourTv to remove Android TV ads

Instructions for installing CleanYourTv to remove Android TV ads

October 29, 2026
Instructions for receiving Avira Prime 3 months for free, no credit card

Instructions for receiving Avira Prime 3 months for free, no credit card

October 31, 2026
Instructions for cleaning LG TV with Antigravity to help it run faster

Instructions for cleaning LG TV with Antigravity to help it run faster

October 30, 2026
Cách hạn chế Synology NAS bị Ransomware .L0CK3D: Cách khắc phục

Cách hạn chế Synology NAS bị Ransomware .L0CK3D: Cách khắc phục

October 30, 2026
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

Instructions for receiving Avira Prime 3 months for free, no credit card

Instructions for receiving Avira Prime 3 months for free, no credit card

October 31, 2026
Instructions for cleaning LG TV with Antigravity to help it run faster

Instructions for cleaning LG TV with Antigravity to help it run faster

October 30, 2026
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

say88 tỷ lệ kèo nhà cái kèo nhà cái 5 febet

No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

say88 tỷ lệ kèo nhà cái kèo nhà cái 5 febet

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply