Monitor folder size

1

Is there a way to monitor and log folder size in Bash/Ubuntu? I'm running some computations and I need to know how much disk space they need. They may create some temporary folders for a few minutes/hours.

In fact, I need only a peak size of this folder.

AleX

Posted 2019-12-04T13:43:43.410

Reputation: 11

Is polling good enough? – Eugen Rieck – 2019-12-04T13:50:55.957

$Eugen, I was hoping there is some bash command for this or sth. like this. – AleX – 2019-12-04T13:54:47.540

A two-liner in bash to poll, but no follower I am aware of – Eugen Rieck – 2019-12-04T13:58:34.140

Answers

0

you might try something like:

watch "du -skh /your-directory"

If size/number of file increases set interval with "-n" to much greater than 2 sec

Best,

Bodo

Bodo

Posted 2019-12-04T13:43:43.410

Reputation: 1

Hi, I tried that but the content of the log file looks bad, if I do: watch -n 1 "du -skh working_directory" >> resMon.txt – AleX – 2019-12-04T19:04:09.087

0

watch is not created to produce log-files.

What you search is something like:

#!/bin/bash
while :
do
    du -skh /your-directory
    echo "Press [CTRL+C] to stop.."
    sleep 1
done

Bodo

Posted 2019-12-04T13:43:43.410

Reputation: 1