Skip to main content

All Questions

Tagged with
1 vote
1 answer
195 views

Only print terminal directories in "du"?

Is there a generalized solution for getting only the deepest directories? Counting slash characters won't work, because if I change to --max-depth=4, the deepest directories won't all have the same ...
RonJohn's user avatar
  • 261
4 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 ...
Hashim Aziz's user avatar
  • 13.1k
0 votes
2 answers
73 views

Can I give a script elevated file access and run it from my current user?

I have a script (I call it dusort.sh) I use to gauge which files are taking up the most space on my drive in a given folder. It essentially boils down to this: #!/bin/bash du --all --human-readable -...
andykais's user avatar
  • 101
5 votes
1 answer
967 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 ...
wvxvw's user avatar
  • 885
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)...
bballdave025's user avatar
0 votes
1 answer
83 views

Unexpected behavior with -h flag passed to du

As long as I've been living in *nix world I've lived under the assumption that when a command accepted a -h flag the only thing I was changing was effectively formatting of a print statement. I don't ...
Slater Victoroff's user avatar
-3 votes
1 answer
1k views

Does `du /` list every single file on a system? [closed]

Does du / list every single file? || Is there a better way?
voices's user avatar
  • 2,751
0 votes
3 answers
425 views

du -sh : I don't get why these two results are different

I need to know the size of a folder and some of its sub folders. So I'm trying to use the du command. I cd into the right directory and then try (in bash) : [xxx@yyy TEST]$ du -sh . 4.1G . [xxx@...
Maxx's user avatar
  • 113
0 votes
1 answer
1k views

'Du' command does not list all files

I receive different number of files with du -h and find: loom@loom-desktop$ du -h ~/storage/Apps/*/trunk/test/*.cpp | wc -l 35 loom@loom-desktop$ find ~/storage/Apps/ -path */trunk/test/*.cpp | wc -l ...
Loom's user avatar
  • 385
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 ...
BrainStone's user avatar
151 votes
4 answers
242k 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 ...
Patoshi パトシ's user avatar
3 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 ...
kev's user avatar
  • 12.9k
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
Matt's user avatar
  • 767
0 votes
3 answers
2k views

How do I find out which file type is taking up the most space?

I have a zillion little files in a complex folder hierarchy; these are taking up too much space (ie. terabytes). I'd like to find out which file type (ie., .pdf etc) is taking up all the room so that ...
user avatar