Questions tagged [du]

du is a unix command to measure disk usage

193 questions
0
votes
3 answers

Why "find . -print0 | xargs -r0 du -chx" and "du -chx" different results?

When i try get total size of placed files with find . -print0 | xargs -r0 du -chx it's return: 61G total. When i use standalone du -chx it give me: 2.8T total % df -h give same result: Filesystem Size Used Avail Use% Mounted on /dev/md7 …
rezax
  • 3
  • 1
0
votes
1 answer

du --zip myFile.zip?

What's the easiest way to use the "du" command on zip files? I'm sure this is quite a common use case, but I couldn't find anything using Google. I'd rather not resort to mounting the zip file and running du as if it was an exploded directory.
Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106
0
votes
2 answers

du -sh behaviour in terminal and from an python script?

With reference to my question at SuperUser, I am facing a puzzling situation where using du -sh /media/ExternalHd/myfolder/* works as expected from terminal, but using p=subprocess.Popen(['du', '-sh', '/media/ExternalHd/myfolder/*'],…
Stacked
  • 841
  • 2
  • 12
  • 23
0
votes
2 answers

sudo bashfile makes syntax error

i have got a bash file which i want to toggle via the sudo crontab list. Problem is, that it does not work, because when i run the script with sudo, there is a syntax error message on this line: size=(`du -h $backupDir --summarize`) If i run the…
modmoto
  • 2,901
  • 7
  • 29
  • 54
0
votes
1 answer

Using du to get size of specific sub directories

I'm trying to write a script to summarise a bunch of folders. So I have the following structure: monitor/abc_123 1G monitor/abc_213 1G monitor/abc_111 2G monitor/bbc_123 2.5G What I need is to issue a command (using du I presume) to summarise the…
btongeorge
  • 421
  • 2
  • 12
  • 23
0
votes
1 answer

how to use du -sh inside bash script

I want to create a keeper on my jobs file on the HPC in the campus. Should my disk usage exceed 50GB I want all my jobs to stop (and possibly get an email about this). What I want to do is something of this sort: #!/bin/bash run=1 while [ $run -gt…
Yotam
  • 10,295
  • 30
  • 88
  • 128
-1
votes
1 answer

store diskspace value into variable

Using du command to get disk space, but only wanted the value, without the path. I am able to print using awk, but how to store only the value into variable? du -sh $path | awk '{print $1}' 27G du -sh $path 27G $path
walker
  • 157
  • 5
-1
votes
1 answer

How to use 'grep -v' on 'du' output in Linux?

I'm running below command: du -hs * | sort -hr | grep -v "*directory*" But, I getting output as below: [myuser@ip-1-2-3-4 opt]$ du -hs * | sort -hr | grep -v "*cannot read directory*" du: cannot read directory ‘XYZ’: Permission denied du: cannot…
Temp Expt
  • 305
  • 1
  • 4
  • 17
-1
votes
1 answer

How to make du command throw input/output error

How to make du command throw input/output error. For some reason, I want to reproduce this use case and want to verify my fix before changes pushed to production. I am not able to understand how to reproduce this use case. I tried so many thing, but…
-1
votes
1 answer

Linux: Get the real size of the files in a folder

I have two identical folders on different systems (diff shows that they are the same). However, du, du --apparent-size or the Dolphin-size of the folders show different sizes. I think this is related to the block sizes or the way a folder is…
Matthiasho
  • 69
  • 5
-1
votes
1 answer

how to grep only the first word of the output

du -sb /home/user 1001869274 /home/user How to grep only the numerical value (1001869274 in this case) and store it into a variable, like size=$(du -sb /home/user ...)
call-me-corgi
  • 193
  • 4
  • 10
-1
votes
1 answer

The du command doesn't terminate on its own without a keyboard interrupt

Hello I have a windows 10 computer and am using Git Bash version 2.23.0. I am trying to learn how to write basic scripts following an online tutorial. The goal of this code would be to write the output to a different file as an html file. However…
-1
votes
1 answer

MacOS disk usage for directory reported as zero

In MacOS, the reported disk usage for a directory is sometimes reported as zero e.g. $ du /etc 0 /etc But, how is it possible to store any directory content without any blocks?
fatdragon
  • 2,211
  • 4
  • 26
  • 43
-1
votes
1 answer

recursively finding size of binary directories in linux

Could you recommend a good utility/BASH function that scans a directory and outputs it's size? I need to find the size of the executables in the binary directories: /usr/bin and /bin in order to find their average and median. I am not sure whether…
hps13
  • 1
-1
votes
1 answer

Why directory copied with cp command has less size than the original one

I am tying to copy one directory with big amount 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 the same as the original one: du -s src_dir 3782288…
Hirurg103
  • 4,783
  • 2
  • 34
  • 50
1 2 3
12
13