Questions tagged [du]
69 questions
1292
votes
39 answers
How can I sort du -h output by size
I need to get a list of human readable du output.
However, du does not have a "sort by size" option, and piping to sort doesn't work with the human readable flag.
For example, running:
du | sort -n -r
Outputs a sorted disk usage by size…
Tom Feiner
- 16,158
- 8
- 28
- 24
39
votes
7 answers
du vs. df difference
I have a fileserver where df reports 94% of / full. But according to du, much less is used:
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 270G 240G 17G 94% /
# du -hxs /
124G /
I read that open but…
Andreas Kuntzagk
- 751
- 1
- 6
- 9
33
votes
4 answers
What is the difference between du -h and ls -lh?
I am having a difficult time grasping what is the correct way to read the size of the files since each command gives you varying results. I also came across a post at…
PeanutsMonkey
- 1,782
- 8
- 24
- 27
22
votes
3 answers
FreeBSD: How to know real file size on zfs with compression on?
I'm using zfs on my FreeBSD 9.0 x64 and pretty happy with it, but I find it hard to count directory real, not compressed, size.
Surely I can walk over the directory and count every file size with ls, but I'd expect some extra key for du for that…
Alexander
- 674
- 2
- 11
- 19
16
votes
1 answer
Disk space usage doesn't add up with df & du
I'm trying to free up some disk space - if I do a df -h, I have a filesystem called /dev/mapper/vg00-var which says its 4G, 3.8G used, 205M left.
That corresponds to my /var directory.
If I descend into /var and do du -kscxh *, the total is…
Codecraft
- 283
- 2
- 5
- 15
9
votes
3 answers
du command takes WAY too long to run
I am running du -sh in a variety of directories to find disk hogs. I got two identical servers (Dell PE2850s), both with RHEL5 and it will take significantly longer to run du on one server over the other.
For example, doing du -sh /opt/foobar…
Jon Weinraub
- 267
- 1
- 3
- 14
9
votes
1 answer
Ubuntu server: hard drive always full
I have a 50GB vps
when I run df I get
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 49982172 46580100 863064 99% /
none 507212 172 507040 1% /dev
none …
Krayons
- 93
- 1
- 4
6
votes
1 answer
What is right way to show folder usage in megabytes
I'm using du -bs to count folder size.
du -bs /folder
Result is 96342835 in Bytes... so in MB is it (/1024/1024) 91,87MB.
OK, but when I use
du -hs /folder
Result is different. 99MB
Or
du -s taxikondrat.cz/
100980 KBytes = 98,61MB
I tried…
Pavel
- 357
- 6
- 15
6
votes
3 answers
Understanding the different directory sizes
When comparing
root@debian:~# du -s /backup/test1/
5605364 /backup/test1/
two directories with du,
root@debian:/etc/init.d# du -s /data/test1/
5605360 /data/test1/
du tells me that there is a small difference in the total size of each…
Rene
- 93
- 4
6
votes
2 answers
inconsistency between du -sh and df -h
I know this is a common occurrence when the result of du -sh is smaller than that returned by the file system with df -h. (Because some files are still open in processes etc..) But in my case I have the opposite.
I'm running Ubuntu 12.04 and trying…
D.Mill
- 379
- 3
- 15
6
votes
6 answers
Get Size of All Folders in Directory
I want to get the size of all directories within a specific directory. I was thinking something like
find . -type d -exec du -sh {} \;
But that returns all directories recursively. How can I limit the depth?
Steve Robbins
- 1,884
- 4
- 23
- 26
5
votes
2 answers
Next-gen filesystems: disk space usage log?
From time to time I run into problems when server hard disks (Linux) fill up quickly with lots of small files. When this happens I have to try to figure out how much space is being taken up and where the files are that are taking up the space. This…
Tom Scrace
- 163
- 4
5
votes
4 answers
Disk full on linux server, blocks used is much less then blocks avalable
Output of df is:
[root@backup log]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/VolGro 1889811408 1861658948 0 100% /
/dev/sda1 101086 16235 79632 17% /boot
tmpfs …
jw.
- 51
- 1
- 3
5
votes
4 answers
How to do "du" on all files under a directory in linux?
This is what I tried:
[demo@ ~]# ll /usr/local/apache2/logs/|xargs |du -hm -
du: cannot access `-': No such file or directory
I want to see the amount of space each file occupies in m unit.
How to do it the correct way?
kernel
- 7,971
- 5
- 17
- 14
4
votes
3 answers
du -sh * show significant more used space that ls -lah
I am having trouble with running out of diskspace of one of my clients servers.
The output of the commands ls -lah in /var/lib/mysql shows:
drwx------ 2 mysql mysql 16K Dec 30 2015 database_xyz
But when I check the filesize in the same catalogue…
Orphans
- 1,386
- 15
- 25