Questions tagged [du]
75 questions
1527
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
- 18,778
47
votes
4 answers
How do I see du in GB instead of MB in linux?
This works: du -cshm . But this fails: du -cshg . How can I see it in unit of GB?
apache
- 3,617
- 7
- 30
- 25
46
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 deleted files could be responsible…
Andreas Kuntzagk
- 861
38
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,972
29
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
- 874
20
votes
4 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 will…
Jon Weinraub
- 387
- 1
- 5
- 16
17
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 2.1G…
Codecraft
- 293
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 511676 4 511672 1% /dev/shm none 511676 76 511600 1% /var/run none 511676 0 511676…
Krayons
- 93
8
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,951
7
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 different…
Pavel
- 487
7
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,603
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 directory.…
Rene
- 93
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
- 6
- 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
- 2,222
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