Page 1 of 1

Is your disk/partition full?

Posted: 22 Jan 2013, 12:41
by viking60
We have had some tips here on how to remove stuff to free up space like the removing of "devel" files. But I did a check here and found nothing about how to find the biggest files and directories.

Now this is probably because everybody knows how to do it, but I thought I should write down some ways of doing it (and start a landslide of suggestions on better ways of doing it).

Let us start with finding the biggest directories sorted with the biggest on top:

Code: Select all

du | sort -nr | head

You can specify the no. of lines to show by adding -n10 (show 10 lines)

Code: Select all

du | sort -nr | head -n10

We are using the pipe "|" to pass arguments from one command to the next. The head command only shows the head of the list so if you want to see the entire (and probably very long) list you can do it like this:

Code: Select all

du | sort -nr | less
The "less" command makes the output "scrollable" (You go to the next page with <ENTER> and quit wih "q")!; one page at the time so that you do not have to scroll back for 5 minutes to get back to the top of the list.

If you want to check out your partitions you can simply replace du above with df like this:

Code: Select all

df | sort -nr | less



If you are looking for a certain type of files in this directory you could do it like this:

Code: Select all

find *.txt| sort -nr

This will show all your .txt files sorted from the biggest to the smallest.
To find everything beginning with "berserk" in the current directory with sub-directories

Code: Select all

find berserk* | sort -nr |less

And there are probably way better ways of doing this :-D
So ... the stage is yours:
:A

Re: Is your disk/partition full?

Posted: 22 Jan 2013, 14:51
by rolf
In Mandriva, 'df' shows partition-level disk usage:

Code: Select all

[rolf@localhost ~]$ df | sort -nr
none            7.8G   64K  7.8G   1% /tmp
Filesystem      Size  Used Avail Use% Mounted on
/dev/sdf5       196G   79G  118G  41% /media/win_c
/dev/sdf1       928G  602G  327G  65% /home
/dev/sde1        27G   17G  9.6G  64% /moz
/dev/sdd1       932G  352G  581G  38% /movie
/dev/sdc3       1.8T  903G  911G  50% /download
/dev/sdb6        89G   18G   72G  20% /media/win_c3
/dev/sdb3       306G  203G  104G  67% /News
/dev/sdb2        44G   28G   17G  63% /music
/dev/sda2        27G   13G   14G  49% /
/dev/sda1        30G   16G   14G  55% /media/win_c4


In Mandrake, Mandriva, there was a pretty nice gui application, kdirstat, which showed the big files and directories, graphically.

:A

Image

I think that was only for KDE3. There is/was a KDE4 port, k4dirstat, that can be found in Ubuntu, Debian, git, and rpms.

For some reason, I can't find k4dirstat in my Mandriva 2011 x86_64 sources but the rpm at rpmfind installs and seems to work.

:A

Image

Re: Is your disk/partition full?

Posted: 22 Jan 2013, 15:16
by viking60
rolf wrote:In Mandriva, 'df' shows partition-level disk usage:


Uh yes I was spaced out there (got a call while writing) - df does that everywhere :oops:

Allthough this will actually find files:

Code: Select all

df | sort -nr | grep *.txt

Mainly because sort -nr | grep *.txt does exactly the same :-D (I have edited it)

I have seen that K4dirstat before but I am not sure I get that plastic GUI :confused Is that meant to be an Image of my HD?

Re: Is your disk/partition full?

Posted: 25 Jan 2013, 14:16
by dedanna1029
There was a way I found while discussing it on the MDV forum a good ways back, to get a human-readable output with du:

Code: Select all

du -akxh / | sort -nr | head -n xx


(Where the / is, of course, you can use whatever folder to check, and xx is number of lines.)

I don't know if this still works, though.

Re: Is your disk/partition full?

Posted: 15 Nov 2013, 15:11
by viking60
Best way of dealing with it in this Wiki +1

Re: Is your disk/partition full?

Posted: 05 Dec 2014, 23:23
by dedanna1029
hhmmm... I know this is a very old topic, but I'm wondering if that Wiki is one of the files you had to remove to get some badly needed space back? *lol*

Re: Is your disk/partition full?

Posted: 06 Dec 2014, 18:33
by viking60

Re: Is your disk/partition full?

Posted: 07 Dec 2014, 23:47
by dedanna1029
Oh, that's right! :(
Thanks.