0
0
Bash Scriptingscripting~5 mins

Network monitoring script in Bash Scripting - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the main purpose of a network monitoring script?
To automatically check the status and performance of network devices or connections, helping detect issues early.
Click to reveal answer
beginner
Which command is commonly used in bash scripts to check if a host is reachable?
The ping command is used to send ICMP echo requests to test if a host is reachable.
Click to reveal answer
intermediate
In a bash network monitoring script, how can you log the output of a command to a file?
Use the redirection operator > filename to append output or > filename 2>&1 to include errors.
Click to reveal answer
intermediate
What does the following bash snippet do? <br>
if ping -c 1 8.8.8.8 > /dev/null; then echo 'Up'; else echo 'Down'; fi
It sends one ping to 8.8.8.8, suppresses output, and prints 'Up' if reachable or 'Down' if not.
Click to reveal answer
beginner
Why is it useful to run a network monitoring script periodically using cron?
Because it automates regular checks without manual effort, helping catch network problems early and consistently.
Click to reveal answer
Which bash command is best to check if a website is reachable?
Aping
Bls
Ccat
Dmkdir
What does the option '-c 1' do in the ping command?
ASends one ping packet
BCounts all packets
CContinues pinging forever
DChanges the packet size
How can you suppress the output of a command in bash?
AUse the echo command
BRedirect output to /dev/null
CUse the ls command
DUse the mkdir command
Which tool can schedule a network monitoring script to run every 5 minutes?
Assh
Bvim
Ccron
Dscp
What is a simple way to log the output of a network check to a file?
AUse pwd command
BUse cd command
CUse rm command
DUse >> logfile.txt after the command
Describe how you would write a bash script to check if a server is online and log the result.
Think about sending one ping, checking success, and saving the result quietly.
You got /4 concepts.
    Explain why automating network checks with scripts and scheduling tools is helpful in real life.
    Consider how regular checks help avoid surprises.
    You got /4 concepts.