0
0
Bash Scriptingscripting

Disk space monitoring script in Bash Scripting - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What command in bash can you use to check disk space usage?
You can use the df command to check disk space usage in bash. It shows the amount of disk space used and available on filesystems.
Click to reveal answer
beginner
What does the -h option do when used with the df command?
The -h option makes the output human-readable by showing sizes in KB, MB, or GB instead of blocks.
Click to reveal answer
beginner
In a disk space monitoring script, why do we compare disk usage against a threshold?
We compare disk usage against a threshold to know when disk space is running low. This helps to alert or take action before the disk is full.
Click to reveal answer
intermediate
What bash command can be used to send an alert email from a disk space monitoring script?
You can use the mail or sendmail command to send an alert email from a bash script when disk space is low.
Click to reveal answer
intermediate
How can you schedule a disk space monitoring script to run automatically every day?
You can schedule the script using cron by adding a cron job that runs the script daily at a set time.
Click to reveal answer
Which command shows disk space usage in a human-readable format?
Als -l
Bcat /etc/passwd
Cdf -h
Dps aux
What is a common threshold percentage to alert for low disk space?
A10%
B80%
C50%
D100%
Which bash command can be used to extract just the disk usage percentage from df output?
Aecho
Bgrep
Csed
Dawk
How do you schedule a script to run every day at 2 AM using cron?
A0 2 * * * /path/to/script.sh
B2 0 * * * /path/to/script.sh
C* 2 * * * /path/to/script.sh
D0 0 2 * * /path/to/script.sh
What is the purpose of sending an email alert in a disk space monitoring script?
ATo notify when disk space is low
BTo delete files automatically
CTo backup data
DTo increase disk space
Describe how a basic disk space monitoring script works in bash.
Think about checking disk space, comparing it, and alerting.
You got /4 concepts.
    Explain how to automate running a disk space monitoring script daily.
    Automation uses cron jobs in Linux.
    You got /4 concepts.