• 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

Save image as Type contains malicious code: Remove immediately before losing money unfairly!
Network

Save image as Type contains malicious code: Remove immediately before losing money unfairly!

March 19, 2026
Instructions on how to register a .co.uk domain name for free for 1 year
Network

Instructions on how to register a .co.uk domain name for free for 1 year

March 12, 2026
How to Setup Paperclip AI: Create a Company for AI Agent
Network

How to Setup Paperclip AI: Create a Company for AI Agent

March 12, 2026
Compilation of free and cheap APIs to run OpenClaw stably
Network

Compilation of free and cheap APIs to run OpenClaw stably

March 10, 2026
3 Services to Determine IP Location for Website (IP Geolocation API)
Network

3 Services to Determine IP Location for Website (IP Geolocation API)

March 10, 2026
How to buy a .STORE domain name for 1 USD (2026): Detailed instructions from A–Z
Network

How to buy a .STORE domain name for 1 USD (2026): Detailed instructions from A–Z

March 3, 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
Inline Feedbacks
View all comments

Recent News

Instructions for looking up prescriptions on VNeID instead of paper medical books

Instructions for looking up prescriptions on VNeID instead of paper medical books

April 26, 2026
Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

April 24, 2026
How to compress online videos for free without losing quality

How to compress online videos for free without losing quality

April 24, 2026
Instructions for looking up prescriptions on VNeID instead of paper medical books

Instructions for looking up prescriptions on VNeID instead of paper medical books

April 26, 2026
Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

Compare Poco X8 Pro and Poco X7 Pro: A new step for the “king” of mid-range performance

April 24, 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 looking up prescriptions on VNeID instead of paper medical books

Instructions for looking up prescriptions on VNeID instead of paper medical books

April 26, 2026
Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

Tips to completely turn off CAPTCHA codes on iPhone and Mac are super simple

April 25, 2026
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

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