Monitor Folder Size

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.

3

2 Answers

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

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest