Questions tagged [du]
"du" is the Linux command for reporting Disk Usage
122
questions
147
votes
4
answers
238k
views
Display each sub-directory size in a list format using one line command in Bash?
I want to get a list of the directories and their sizes in a list format like how you get when you do a ls -l.
The thing is that is there a one line command that can do this? I see others have long ...
137
votes
7
answers
93k
views
How to analyse disk usage in command line linux?
du and df are nice, but I don't know how to filter the data they provide the way I do with SequoiaView. I would like to know which are the largest folders and the largest files in a glance.
97
votes
2
answers
143k
views
du only for directories
In C-Shell, how can I get the same output as du -sh ./* but without listing the files in the root dir, i.e. just a list of subdirectories in ./ and the sizes of all their contents?
32
votes
8
answers
31k
views
du which counts number of files/directories rather than size
I am trying to clean up a hard drive which has all kinds of crap on it accumulated over the years. du has helped reduce disk usage, but the whole thing is still unwieldily not due to the total size, ...
28
votes
5
answers
42k
views
How to get the actual directory size (out of du)?
How do I get the actual directory size, using UNIX/Linux standard tools?
Alternative question: How do I get du to show me the actual directory size (not disk usage)?
Since people seem to have ...
22
votes
2
answers
23k
views
Only get the size from "du" command, not the folder names
I am doing an applescript that is supposed to set the size of an folder to an varible. This is the code so far:
set sizeVar to do shell script "du -skh -m /Users/JS_Admin/Desktop"
Output:
"4242 /...
22
votes
1
answer
163k
views
How to know the directory size in CENTOS [duplicate]
I have a website on my server and I own it.
The size of the website is around a whopping 170GB. This shouldn't be this much. At most, it should be around 20GB. I don't know what makes it that big.
I ...
22
votes
4
answers
29k
views
Is it possible to format ps RSS (memory) output to be more human friendly?
Executing ps ux returns a nice list of process information, easy to grep through or watch. However, there doesn't seem to be much flexibility in the memory usage output; the RSS (resident set size) is ...
19
votes
2
answers
4k
views
Why is a directory copied with the cp command smaller than the original?
I am tying to copy one directory with a large number of files to another destination. I did:
cp -r src_dir another_destination/
Then I wanted to confirm that the size of the destination directory is ...
16
votes
3
answers
85k
views
Total disk usage for a particular user
I would like to see the total disk usage for myself on a particular file system. I executed the command
du -h ~my_user_name
However, this lists every directory owned by my_user_name. I would like ...
13
votes
2
answers
6k
views
"du -h" with more decimal places
I'm working on a little util tool written in bash that gives me some information about a game server on Linux. For that reason I need a possibility to display the size of the file contents.
I'm doing ...
8
votes
3
answers
4k
views
Difference between df -k and du -sh
df -k
/dev/sda6 25396228 21249088 2836240 89% /export
21G used
versus
du -sh /export
3.4G /export
The 3.4G is correct because we have removed all non essential file but free ...
7
votes
3
answers
8k
views
du -x still examines mounted filesystems when using wildcards
If I try
du -s -h -x /*
it will try to examine all filesystems (real and pseudo) mounted directly under /, e.g. /dev, /proc, /sys, /run, and /home (/home is on an extra partition).
I think it comes ...
6
votes
1
answer
2k
views
Disk space analyzer that can read du output
I'm looking for a GUI program that can parse du output and show both a browseable file tree and a treemap.
So far i've tried:
xdiskusage, xdu (Linux only, ugly GUI, no tree view)
WinDirStat, ...
5
votes
3
answers
1k
views
How can I get the output of `du -c` without the word `total`?
I want to get the total size of a directory and all directories inside it.
I am using the command
du -h -c "$input_variable" | grep total
It prints the results and the word total. How do I get the ...
5
votes
1
answer
7k
views
Faster du/stat alternative for directories
I have several very big directories and i want to know their estimated size. I use for this purpose mostly du, but it takes for each folder about 3 minutes, so i'm asking if there is an alternative to ...
5
votes
1
answer
910
views
Why does du -b show a different result than stat?
I've recently ran into this problem:
find /tmp/tmp33hn25wv -type f -exec stat --format='%s' {} + | awk '{s+=$1} END {print s}'
10420224
du -bs /tmp/tmp33hn25wv
12198004 /tmp/tmp33hn25wv
Results ...
5
votes
1
answer
2k
views
Why does du -sl show different sizes for the source and result of a cp -rl?
I have used cp -rl to copy a folder. When measuring the size of the source and of the result of the copy du -sl returns slightly different sizes, even though diff confirms that their content are ...
4
votes
2
answers
2k
views
du -h returns 512, what does it mean?
I have some files for which du -h returns 512, my understanding it is supposed to return numbers with units. What does it mean ? What is the actual disk space being used ?
good file
(base) -bash-4.2$ ...
4
votes
4
answers
6k
views
How does du determine which hard link to disregard?
We have two directories:
$ ls -l
total 8
drwxr-x--- 2 nimmy nimmy 4096 Nov 15 19:42 jeter
drwxr-x--- 2 nimmy nimmy 4096 Nov 15 19:42 mariano
I create one file in the first folder:
$ dd if=/dev/zero ...
4
votes
3
answers
5k
views
Why do Finder and du report different file size?
I am writing a geektool 3 script to show the size of a particular VMware Fusion virtual machine. Such .vmwarevm "file" is really a packaged directory.
Get Info in Finder says the file is "52.91 GB". ...
4
votes
1
answer
26k
views
Excluding folders when doing du
I am trying to use du to get a list of the files/sizes on the filesystem (doing this as sudo):
cd /
du --exclude-from="/home"
and I am getting an error message, telling me that /home is a folder.
I ...
4
votes
1
answer
2k
views
Why does “du -sh” show different folder size after copy?
I want to have a simple backup and copied all files from one folder to another. OS is Debian.
When I do a du -shon the source folder I get 436G.
When doing the same on the destination I only get 384G....
4
votes
1
answer
3k
views
Why is `du` on WSL acting giving a directory size greater than machine memory?
I ran into my question while trying to find out which files on my computer are taking up the most space. Here's the information on the total machine memory, found from Windows Subsystem for Linux (WSL)...
3
votes
2
answers
747
views
explanation about du command linux diskusage
What is the difference between these two:
du -h --max-depth=2 /usr/* | sort -nr | head -n 20
And:
du -h --max-depth=2 /usr/ | sort -nr | head -n 20
I would like to display the 20 biggest folder ...
3
votes
2
answers
3k
views
what is faster, du or stat?
Which goes faster on Linux/Unix?
du -b file.dat
or:
stat -c %s file.dat
3
votes
1
answer
3k
views
pass du (disk usage) result to a numeric variable
In a shell script, I'm looking for a way to pass the du (disk usage) result to a numeric variable, so that I cantie the execution of a shell script to the size of a specific folder. I've tried ...
3
votes
2
answers
7k
views
Equivalent of "du --max-depth=0 -h" (or something similar) in Solaris
The du command in my solaris environment has very terse help, no man page, and doesn't support the --max-depth option seen in the linux world.
I want to know how much space a given directory occupies....
3
votes
1
answer
10k
views
Is it safe to delete contents of /root/.cache folder to free up space?
I need to free up disk space on my linux server.
I run the df command to check space ad see that I'm using up 100% of disk space.
myserver:/ # df /
Filesystem 1K-blocks Used Available Use% ...
3
votes
3
answers
2k
views
Get the total size of all files of a given extension
I'm trying to get the total size of all the JPEGs in a particular folder, but no amount of combinations of options while piping to du seems to make this work:
find -type f -iname "*.jpg" | du -sch
...
3
votes
2
answers
7k
views
google cloud storage: find size of sub-folders with gsutil du?
I want to find the size of my sub-folders at the first depth in Google Cloud Storage. There is the function gsutil du, that is quite similar to du, but with some differences.
I am not able to just ...
3
votes
1
answer
325
views
Odd behavior by 'du' with `dd` on a BTRFS disk showing 0 filesize.. Anyone got some clues or thoughts around it?
Been tinkering with btrfs with consideration of moving from ext4 to that.
However, when wanting to compare R/W speeds, I seem to have come across an (to me at least) unusual behavior by du on the ...
3
votes
3
answers
5k
views
Is there a way to force du to report a directory size (recursively) including only sizes of files?
Suppose I create a directory test/, with two files (test/a, test/b) and an inner directory test/c with a file test/c/d, like this:
mkdir test
cd test
touch a
echo 1 > a
touch b
echo 1 > b
mkdir ...
3
votes
0
answers
940
views
Different used disk space with du and quota
If I run quota I get:
Disk quotas for user XXXXXX (uid xxxx):
Filesystem blocks quota limit grace files quota limit grace
/dev/md2 1119132* 1048576 2097152 none 6 0 ...
3
votes
0
answers
217
views
Explaination needed for strange `df` and `du` results
Can someone help me to understand the following output:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 8.0G 7.5G 167M 98% /
udev 7.4G 8.0K 7.4G 1% /dev
...
2
votes
3
answers
5k
views
How do I quickly calculate the size of a directory?
I want to calculate the size of my home directory, which has a lot of sub directories.
It takes about 40 seconds to run du.
Is there a quicker way?
$ time du -sh
5.0G .
real 0m39.676s
user ...
2
votes
2
answers
1k
views
Why doesn't ext4 cache directory size?
Once again I'm cleaning up my desktop because I'm running out of HDD space and everytime I call du -sh ~, it takes a really long time to calculate the current size of the directory.
From my ...
2
votes
3
answers
5k
views
Folder is empty, but du reports high usage
I have a 115GB partition on my hard disk (output of cgdisk /dev/sda is below):
Part. # Size Partition Type Partition Name
--------------------------------------------------------...
2
votes
2
answers
4k
views
How to summarize du results
I'd like to get the sum of all folder sizes produced by
du -sh /*something
That is, instead of:
du -sh /Applications/Adobe*
639M Adobe
871M Adobe Acrobat X Pro
1.0G Adobe After ...
2
votes
2
answers
144
views
optimising 'du' reports on petabyte dataset?
I am trying to get a daily filesize report on a dataset of several Petabytes of genomics data.
Our current report uses multiple overlapping du invocations to achieve the result, but takes over 24 ...
2
votes
2
answers
1k
views
Discrepancy between df and du
I have a question pertaining the difference from 'df -h' and 'du -bs'. I have seen several questions here about it, but the issue was always that 'df -h' was reporting more used space than 'du -bs'. I ...
2
votes
1
answer
163
views
Equivalent of “du --time -h” (or something similar) in Solaris
How can I get something similar to du -h --time at solaris?
2
votes
1
answer
1k
views
why does `du` not show results for all files?
I (for curiosity's sake) am running du -a inside /usr/lib/git-core and it does not show results for all the files in that directory. Why does it leave out an arbitrary set of files?
this is what cd /...
2
votes
2
answers
241
views
du -s /foldername gives totally different output with or without -h option
I just executed the following two commands in the terminal on my Mac (MacOS Sierra):
$ sudo du -s Documents/
11027432 Documents/
$ sudo du -hs Documents/
5.3G Documents/
The info pane reports ...
2
votes
1
answer
126
views
du is giving me inconsistent results depending on argument order
I'm running Darwin (Mac OS X 10.11.2 - the current version of El Capitan) on my Mac Book Pro, but this is about a standard command line utility, du.
I am getting inconsistent results from du:
21:19 %...
2
votes
0
answers
245
views
du shows large space but inside directory it doesn't show the space
I've been trying to track down used space with du, and I'm seeing some odd behavior.
[root@server01 /]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda2 32G 32G 190M 100% /
...
2
votes
2
answers
921
views
How to show uncompressed total physical size in bytes of an HFS-compressed file or directory?
Case in point: Apple's TextEdit at /Applications/TextEdit.app
If you calculate the physical size with echo "$(/usr/bin/du -k -d 0 /Applications/TextEdit.app | /usr/bin/awk '{print $1}') * 1024" | /...
2
votes
1
answer
806
views
Different directory size between GUI and Command Line
I got this weird size problem using Gnome:
the size of Desktop directory is: 541.2 GB
(right click properties)
however when I run this command on a shell I get different size:
du -sh Desktop/
1.1T ...
2
votes
2
answers
1k
views
Centos 6.5 directory size is incorrect using du command
I 'm running the du command on one of my websites directories and I'm getting 2 different result, I'm confused which one is accurate and why there is a big difference, here both command and the output....
2
votes
0
answers
424
views
Ubuntu Server shows that I am running out of disk space, but I can't figure out where it is being used
I am showing that I am running out of disk space and I am having trouble uploading, but I can't figure out where the disk space is being used. I am supposed to have 19 gigabytes, but it looks like ...