Is your disk/partition full?

Every day solutions to every day challenges. + Brilliant stuff

Moderators: b1o, jkerr82508

Forum rules
Please feel free to post your tip it does not have to be advanced. Also ask questions directly related to the tip here. But do not start new threads with questions or ask for help here. That is what the help section is for. forum rules: http://bjoernvold.com/forum/viewtopic.php?f=8&t=568
User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Is your disk/partition full?

Postby viking60 » 22 Jan 2013, 12:41

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
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
rolf
Guru-Berserk
Posts: 1107
Joined: 16 Mar 2010, 16:07

Re: Is your disk/partition full?

Postby rolf » 22 Jan 2013, 14:51

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

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Is your disk/partition full?

Postby viking60 » 22 Jan 2013, 15:16

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?
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8784
Joined: 14 Mar 2010, 20:29
Contact:

Re: Is your disk/partition full?

Postby dedanna1029 » 25 Jan 2013, 14:16

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.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Is your disk/partition full?

Postby viking60 » 15 Nov 2013, 15:11

Best way of dealing with it in this Wiki +1
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8784
Joined: 14 Mar 2010, 20:29
Contact:

Re: Is your disk/partition full?

Postby dedanna1029 » 05 Dec 2014, 23:23

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*
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html

User avatar
viking60
Über-Berserk
Posts: 9351
Joined: 14 Mar 2010, 16:34

Re: Is your disk/partition full?

Postby viking60 » 06 Dec 2014, 18:33

Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
dedanna1029
Sound-Berserk
Posts: 8784
Joined: 14 Mar 2010, 20:29
Contact:

Re: Is your disk/partition full?

Postby dedanna1029 » 07 Dec 2014, 23:47

Oh, that's right! :(
Thanks.
I'd rather be a free person who fears terrorists, than be a "safe" person who fears the government.
No gods, no masters.
"A druid is by nature anarchistic, that is, submits to no one."
http://uk.druidcollege.org/faqs.html


Return to “Tips & Tricks”