Re: 100% used / file system. Help!
Darac Marjal wrote, on 09/23/11 11:53:
> On Thu, Sep 22, 2011 at 04:12:17PM +0100, Lisi wrote:
>> On Wednesday 21 September 2011 22:54:54 Jörg-Volker Peetz wrote:
>> [snip]
>>
> [cut]
>
>> Tux:/home/lisi# du -hx --max-depth=1 / | sort -h
>> sort: invalid option -- h
>> Try `sort --help' for more information.
>> Tux:/home/lisi# du -hx --max-depth=1 / | sort -n
>> 0 /dev
>> 0 /proc
>> 0 /sys
>> 3.4M /root
>> 3.7G /usr
>> 4.0K /backup
>> 4.0K /home
>> 4.0K /mnt
>> 4.0K /selinux
>> 4.2M /bin
>> 6.2M /sbin
>> 11M /etc
>> 16K /lost+found
>> 17M /boot
>> 23G /media
>> 27G /
>> 70M /lib
>> 87M /opt
>> 104K /tmp
>> 200K /srv
>> 662M /var
>> Tux:/home/lisi# du -hx --max-depth=1 /media | sort -n
>> 4.0K /media/cdrom0
>> 4.0K /media/cdrom1
>> 4.0K /media/floppy0
>> 4.0K /media/sdc2
>> 4.0K /media/sdc6
>> 4.0K /media/USB-HDD
>> 22G /media/sdc1
>> 23G /media
>> 164M /media/Distros
>
> As an aside, this is why I don't recommend using "du -h" with "sort -n".
> "du -h" is a great way to see where your space is being used, as it
> presents the sizes in human readable format. However, "sort -n" sorts
> numerically but critically, it doesn't know that, in this instance, 23G
> is larger than 164M. Ideally you need to either use full numeric sizes
> ("du -b" should do) and sort on those or find some method of sorting
> that knows about SI prefixes.
>
> There are, of course, plenty of disk space visualisers in debian (ncdu,
> gdmap and so on), but the problem here was to find the largest
> file/directory without installing extra packages.
>
Recent versions of the sort-command understand the switch "-h" which, I assume,
was introduced just for the usage with du. On my "testing" system the version
number is 8.5 ("sort --version").
--
Best regards,
Jörg-Volker.
Reply to: