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.

41 questions
11
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
  • 2,867
  • 10
  • 34
  • 47
8
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:…
padawanTony
  • 185
  • 1
  • 2
  • 8
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
  • 9,212
  • 7
  • 40
  • 79
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
Nitin Kumar
  • 51
  • 1
  • 3
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.
user1800997
  • 377
  • 1
  • 4
  • 17
4
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…
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…
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
1 answer

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
  • 8,025
  • 7
  • 66
  • 105
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
  • 1
  • 2
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
  • 409
  • 1
  • 4
  • 12
1
vote
2 answers

Find the total space occupied by the ISO's on FS?

I want a awk script to find the sum $1 of the output of sudo find / -type f -iname *.iso -print0 | xargs -0 du Though it wouldn't be difficult to bring the output in human readable format but it would be good if it can be done on the fly. The…
juggernauthk108
  • 921
  • 4
  • 12
  • 28
1
vote
0 answers

keep same inodes metadata with rsync or ignore metadata with du

I'm trying to synchronize two folders from a remote computer. I want to use rsync to send the folder, and du to check if the space used is identical on the remote computer. The problem is even with a rsync success the metadata is not same for…
bob dylan
  • 371
  • 2
  • 3
  • 9
1
vote
1 answer

Can somebody explain this changing `du` output?

Just tripped across a weird case of du. Putting arguments one way gives: $ du -s htdocs/.git/ feuerkraft/.git/ media/.git/ 40564 htdocs/.git/ 40740 feuerkraft/.git/ 204 media/.git/ Putting them in a different order changes the size of the last…
Grumbel
  • 4,679
  • 6
  • 35
  • 51
1
2 3