Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Find heavier file on my operating system

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
Deblib
Posts: 119
Joined: 2016-05-14 14:41

Find heavier file on my operating system

#1 Post by Deblib »

Hi, I would like to know how I can find the file that weighs the most on my hard drive (and how much it weighs).
Thanks!

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Find heavier file on my operating system

#2 Post by Dai_trying »

I found ncdu does a great job.

Deblib
Posts: 119
Joined: 2016-05-14 14:41

Re: Find heavier file on my operating system

#3 Post by Deblib »

Great tool! :)
But, would it be possible with the command find or similar by the Terminal?

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: Find heavier file on my operating system

#4 Post by sunrat »

This will list files in CWD in size order:

Code: Select all

du -sh * | sort -hr
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: Find heavier file on my operating system

#5 Post by debiman »

Deblib wrote:Great tool! :)
But, would it be possible with the command find or similar by the Terminal?
yes.

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Find heavier file on my operating system

#6 Post by Dai_trying »

debiman wrote:
Deblib wrote:Great tool! :)
But, would it be possible with the command find or similar by the Terminal?
yes.
To expand on this a little, you can use find to do this but you will obviously need to do some filtering and/or sorting of the results to get the information you want.

If you just want to largest file you could use sort and then tail to give only the first (or last depending on sort order) result, but this might use a lot of resources, especially if you are using find from the root of your system as it would sort ALL the results of find.

Post Reply