Questions tagged [du]

du is the standard Unix/Linux command to measure disk usage. Use this tag for questions specifically about the use of the du program.

The du program displays the file space allocated to each file and directory contained in the targeted directory. When run on the root directory /, it is normal to see a discrepancy between the result of du and df. This is because of files that may have been deleted but their blocks not yet freed, combined with the reserved space set by minfree.

44 questions
13
votes
2 answers

How to get a full size of directory without listing the files/dir within?

I am able to get a size of a directory at the end of the du -h directoryname. But is there a way to get the size without it listing the files/directories within? I'm currently doing it like this: du -h directoryname | tail -n1 How to keep an index…
alvas
  • 3,027
9
votes
1 answer

Real size of folder?

When I run du -hs Folder in the terminal I get: 118M When I run du -s Folder in the terminal I get: 120664M When I run du -h Folder in the terminal I get: 118m When I find the size through the file explorer (right click -> properties) I get:…
7
votes
2 answers

Prevent du command report inflated info about /snap directories

I have an Ubuntu 20.04 server installed on a single 8GB drive. The default installation has some "snap"s installed also. So, there are some "squashfs" file systems also reported by the df command: # df -mT Filesystem Type 1M-blocks Used…
FedKad
  • 13,420
5
votes
1 answer

Sort files and folders in ascending order of size

How can I use du -h to sort the displayed files and directories in ascending order of size?
D-T
  • 506
5
votes
1 answer

Print size of directory content with tree command, but exclude files from report

I often use du --max-depth=n -h | sort --human-numeric-sort Now I want to use tree, in a similar manner. I found here a partial answer tree -sh --sort=size --du where --du makes tree reporting the cumulative size for each directory (as du). This…
5
votes
1 answer

What is difference between ls -lh and du -sh?

$ ls -lh file1.tar -rw-r--r-- 1 wnice wnice 40K Aug 6 20:41 file1.tar $ du -sh file1.tar 80K file1.tar Why is it showing different sizes of same file? Please help me understand
4
votes
2 answers

du command - show file or folder in output?

If I run the command du -ah | sort -nr is it possible to make it show which line in the output is a file and which folder? Something like the command ls -l shows which is file and folder with d and - in front.
4
votes
2 answers

How to make `ncdu` show a quick summary of disk usage and exit?

I'd like to make the ncdu NCurses Disk Usage tool analyze a path, display the output, and exit, for scripting purposes. Normally it is a human-interactive tool, but I'd like to remove the human-interactive part of it. If I run ncdu /boot I can see…
Gabriel Staples
  • 11,502
  • 14
  • 97
  • 142
3
votes
3 answers

Bash Script - How can I get the size of directories in .txt file and save them into other file?

I started a few weeks with Linux bash programming, but I'm struggling with a problem: How can I get the size of multiple directories (path saved on a .txt file) and then, write into another file, the directory path, followed by size and the total…
user5445222
  • 33
  • 1
  • 5
2
votes
1 answer

Intermittent - Error: No space left on device

Having intermittent issues when starting and stopping searches. I get a Error: No space left on device intermittently. Have done some searches and most fixes are related to inodes, which you can see is not my issue. It looks like the disk is not…
2
votes
2 answers

df -h shows 2TB external HDD is almost full but the output for 'du' does not add up

The system that I am using has 18.04 (no dual boot). I have a 2TB Seagate external hard drive which I use for taking the backup of my Ph.D. data. I use rsync -rtvhP to take backups. Recently during one of my backups, rsync failed and I saw that the…
2
votes
1 answer

Can't find what is filling root

Ubuntu server 20.04.1 with Kubuntu Desktop. I have tried lots of tools like Baobab, Kdirstat, Qdirstat and Filelight. All show my root to be about 30 GB. However Dolphin(File Manager) and all the partition managers insist my root is nearly…
2
votes
0 answers

No space left on device, even though there is

similar questions on this site did not have a solution for me. I'm developing a web app with symfony, and tried to start a local server, which resulted in a warning and didn't start anything che6yp@aspire:~/Projects/hometowns_api$ symfony…
CHE6yp
  • 21
2
votes
1 answer

File size differs between ls and ncdu

I'm a little confused. With ls -laght a file with the size 1,0T is displayed: -rw------- 1 nogroup 1,0T May 6 14:01 nextcloud-flat.vmdk with ncdu only 9,1 GB: /mnt/backup/backup/nextcloud/nextcloud-2019-05-06_11-23-12 9.1 GiB [###########]…
1
vote
1 answer

Unable to free diskspace by removing files and not restarting the computer (hibernation possible)

I have a similar problem to the one mentioned here: Unable to free up space in df but I can not reboot (I have important data in the memory). The output of df -h / is: Filesystem Size Used Avail Use% Mounted on /dev/sda2 47G 45G 0…
abukaj
  • 485
1
2 3