Questions tagged [du]
71 questions
1347
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,758
- 8
- 29
- 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
- 761
- 1
- 6
- 9
34
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,832
- 8
- 26
- 27
23
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
- 724
- 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
10
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
- 277
- 1
- 3
- 15
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
- 397
- 6
- 16
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
- 5
- 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,904
- 5
- 23
- 26
6
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
- 8,211
- 5
- 18
- 14
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
1 answer
Why does df -h still show 100% full even after deleting files?
The disk space on my Ubuntu web server, running on DigitalOcean, seems to be full. I have already found and deleted the large log file and restarted Nginx. However, it still seems like there is a problem.
df shows that it's still full:
$ df -h…

Andrew
- 3,293
- 8
- 32
- 35