Questions tagged [du]

du is a unix command to measure disk usage

175 questions
78
votes
4 answers

Error when calling 3rd party executable from Powershell when using an IDE

I have a PowerShell script that uses du.exe (Disk Usage originally from Sysinternals) to calculate the size of directories. If I run du c:\Backup in the console, it works as expected, but the same line of code run in ISE or PowerGui gives the…
Lucas
  • 783
  • 1
  • 5
  • 4
72
votes
2 answers

du counting hardlinks towards filesize?

I have a backup system that creates directories named after Unix Timestamps, and then creates incremental backups using a hardlink system (--link-dest in rsync), so typically the first backup is very large, and then later backups are fractions as…
Dan LaManna
  • 3,178
  • 4
  • 20
  • 31
55
votes
3 answers

Show human-readable file sizes in OSX terminal

In Linux, I type du -sh * | sort -rh to display the files and directories in my current directory, sorted from largest to smallest. How do I do this in OSX terminal, preferably without installing anything extra?
Alex Shroyer
  • 2,824
  • 2
  • 20
  • 47
54
votes
5 answers

Exclude all permission denied messages from "du"

I am trying to evaluate the disk usage of a number of Unix user accounts. Simply, I am using the following command: du -cBM --max-depth=1 | sort -n But I’ve seen many error message like below. How can I exclude all such “Permission denied” messages…
Wen_CSE
  • 875
  • 2
  • 7
  • 8
36
votes
5 answers

why is the output of `du` often so different from `du -b`

why is the output of du often so different from du -b? -b is shorthand for --apparent-size --block-size=1. only using --apparent-size gives me the same result most of the time, but --block-size=1 seems to do the trick. i wonder if the output is then…
knittl
  • 197,664
  • 43
  • 269
  • 318
33
votes
2 answers

How to Exclude a Specific Directory in NCDU Command

How to exclude a directory from ncdu scanning? I can't found the information in man ncdu page. When doing ncdu -x / it scanned my /home/tmp directory for almost an hour. Thanks for any help.
Drunken M
  • 1,075
  • 1
  • 7
  • 15
22
votes
2 answers

Listing the results of the du command in alphabetical order

How can I list the results of the du command in alphabetical order? I know I can use the find command to list them alphabetically, but without the directory size, I also use the -maxdepth option for both commands so that the listing only goes down…
Michael O'Reggio
  • 369
  • 1
  • 4
  • 13
18
votes
1 answer

Excluding hidden files from du command output with --exclude, grep -v or sed

I'm trying to check with Disk Usage tool how big are my home directory folders but it also prints out folders and files starting with dot. I can't seem to filter them out. du -h --exclude="?" du -h | grep -v "?" du -h | grep -ve "?" du -h | sed…
sebastian_t
  • 999
  • 2
  • 10
  • 30
18
votes
1 answer

du -h --max-depth=1 takes long time

When I try to calculate the size of files and directory inside the directory it takes longer time. The command I used is du -ch --max-depth=1. Is there any other way to calculate total size of files and folder? Thanks
Özzesh
  • 727
  • 3
  • 7
  • 15
15
votes
2 answers

Use pipe with du to compute "size" of stdin

I have a program in which I load text from a file and then filter it according to one of the fields. What I am interested in is the size of the data after this filtering step. Ideally, I would be able to do something like: awk '$2>=10'
reo katoa
  • 5,693
  • 1
  • 16
  • 30
13
votes
1 answer

How can I make the "du" command run without outputting all the directories, like quiet mode?

I am trying to get the size of a directory in Linux but it has a lot of subdirectories and seems to take forever to go through all of these files and directories before giving me an answer to what size it is. I've searched the help and manual entry…
phocks
  • 1,745
  • 3
  • 19
  • 26
12
votes
3 answers

Run du on parallel

I have a very big storage disk (16T). I want to run 'du' on it to figure out how much each subdirectory takes. However, that takes a very long time. Luckily, I have at my disposal a cluster of computers. I can therefore run 'du' on parallel, each…
R S
  • 9,831
  • 9
  • 36
  • 48
11
votes
3 answers

How to calculate the total size of certain files only, recursive, in linux

I've got a bunch of files scattered across folders in a layout, e.g.: dir1/somefile.gif dir1/another.mp4 dir2/video/filename.mp4 dir2/some.file dir2/blahblah.mp4 And I need to find the total disk space used for the MP4 files only. This means it's…
nooblag
  • 289
  • 1
  • 4
  • 13
10
votes
2 answers

Linux du command without traversing mounted file systems

If the wording of the question is wrong, please let me know. It might explain why I can’t find an answer. I want to find the usage on my main disk using a command like: du -sh /* The problem is that I have a number of mount points at the root…
Manngo
  • 8,349
  • 6
  • 50
  • 74
9
votes
3 answers

How to monitor the size of a directory via Telegraf

We need to monitor the size of a directory (for example the data directory of InfluxDB) to set up alerts in Grafana. As mentioned here: How to configure telegraf to send a folder-size to influxDB , there is no built-in plugin for this. We don't mind…
Tw Bert
  • 3,470
  • 16
  • 24
1
2 3
11 12