Questions tagged [disk-usage]

Hard disk space usage: how much space do my files take?

What takes up disk space and how to analyze disk usage.

Frequently Asked Questions

993 questions
1473
votes
16 answers

How do I get the size of a directory on the command line?

I tried to obtain the size of a directory (containing directories and sub directories) by using the ls command with option l. It seems to work for files (ls -l file name), but if I try to get the size of a directory (for instance, ls -l /home), I…
Abdul Al Hazred
  • 23,792
  • 22
  • 62
  • 85
740
votes
40 answers

Tracking down where disk space has gone on Linux?

When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time before any results are returned. Also, this is…
Owen Fraser-Green
254
votes
18 answers

How do you sort du output by size?

How do you sort du -sh /dir/* by size? I read one site that said use | sort -n but that's obviously not right. Here's an example that is wrong. [~]# du -sh /var/* | sort -n 0 /var/mail 1.2M /var/www 1.8M /var/tmp 1.9G /var/named 2.9M …
xenoterracide
  • 55,442
  • 70
  • 180
  • 243
229
votes
11 answers

How to recursively find the amount stored in directory?

I know you are able to see the byte size of a file when you do a long listing with ll or ls -l. But I want to know how much storage is in a directory including the files within that directory and the subdirectories within there, etc. I don't want…
Rob Avery IV
  • 2,915
  • 3
  • 16
  • 14
175
votes
3 answers

Finding all large files in the root filesystem

I have a linux server, which currently has below space usage: /dev/sda3 20G 15G 4.2G 78% / /dev/sda6 68G 42G 23G 65% /u01 /dev/sda2 30G 7.4G 21G 27% /opt /dev/sda1 99M 19M 76M 20%…
Abhishek dot py
  • 2,273
  • 4
  • 15
  • 13
152
votes
4 answers

Find and remove large files that are open but have been deleted

How does one find large files that have been deleted but are still open in an application? How can one remove such a file, even though a process has it open? The situation is that we are running a process that is filling up a log file at a terrific…
dotancohen
  • 14,597
  • 23
  • 78
  • 112
135
votes
4 answers

Why are there so many different ways to measure disk usage?

When I sum up the sizes of my files, I get one figure. If I run du, I get another figure. If I run du on all the files on my partition, it doesn't match what df claims is used. Why are there so many different figures for the total size of my files?…
Gilles 'SO- stop being evil'
  • 766,554
  • 187
  • 1,586
  • 2,083
129
votes
9 answers

Which installed software packages use the most disk space on Debian?

Disk space on my root partition is running low, so I want to delete some applications from the system. How can I see which software packages use the most disk space? Is it possible to view that from aptitude? I know about generic disk space…
Mirzhan Irkegulov
  • 7,888
  • 11
  • 42
  • 54
120
votes
4 answers

Reserved space for root on a filesystem - why?

I understand that by default, newly created filesystems will be created with 5% of the space allocated for root. I also know you can change the defined space with: tune2fs -m 1 /dev/sdXY What I'm curious about though, is what the actual purpose for…
suitedupgeek
  • 1,303
  • 2
  • 9
  • 7
112
votes
7 answers

Using --exclude with the du command

This is probably something basic but I'm not able to make it work. I'm trying to use DU to get a total size of files minus certain directories. I need to exclude one specific directory called uploads but not every directory called uploads. For…
Will
  • 1,223
  • 2
  • 8
  • 5
110
votes
14 answers

How to understand what's taking up disk space?

I'm looking for a linux alternative to WinDirStat. I would like to know what is taking up space on my hard drives. A program that works on console and doesn't require a UI is preferred .
ripper234
  • 29,573
  • 43
  • 82
  • 90
87
votes
3 answers

Print size of directory content with tree command in tree 1.5?

I like tree it's a nice way to display my files and the size of folders/directories. But the -h option only shows the size of the directory, not the cumulative size of its contents. /media/ ├── [ 16K] 64D9-E862 │   ├── [8.0K] downloads I know for…
AncientSwordRage
  • 1,624
  • 1
  • 20
  • 26
79
votes
11 answers

How do I count all the files recursively through directories

I want to see how many files are in subdirectories to find out where all the inode usage is on the system. Kind of like I would do this for space usage du -sh /* which will give me the space used in the directories off of root, but in this case I…
xenoterracide
  • 55,442
  • 70
  • 180
  • 243
77
votes
7 answers

Tell fs to free space from deleted files NOW

Is there a way to tell the kernel to give back the free disk space now? Like a write to something in /proc/ ? Using Ubuntu 11.10 with ext4. This is probably an old and very repeated theme. After hitting 0 space only noticed when my editor couldn't…
Marcos
  • 2,215
  • 2
  • 22
  • 31
76
votes
6 answers

Getting size with du of files only

How can I get the size of all files and all files in its subdirectories using the du command. I am trying the following command to get the size of all files (and files in subdirectories) find . -type f | du -a But this prints out the folder sizes as…
Shardul Upadhyay
  • 863
  • 1
  • 6
  • 5
1
2 3
66 67