0
0
Linux CLIscripting~10 mins

Cron log monitoring in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the command to view the cron log file.

Linux CLI
tail -f /var/log/[1]
Drag options to blanks, or click blank then click option'
Amessages
Bcron.log
Csyslog
Dcron
Attempts:
3 left
💡 Hint
Common Mistakes
Using syslog or messages file which contain many other logs.
Adding file extensions like .log which may not exist.
2fill in blank
medium

Complete the command to search cron logs for errors.

Linux CLI
grep '[1]' /var/log/cron
Drag options to blanks, or click blank then click option'
Aerror
Bcron
Cfail
Dwarning
Attempts:
3 left
💡 Hint
Common Mistakes
Searching for 'cron' which matches all lines.
Using 'warning' which may miss errors.
3fill in blank
hard

Fix the error in the command to view cron logs with timestamps.

Linux CLI
awk '[1]' /var/log/cron
Drag options to blanks, or click blank then click option'
Aprint
B{print $1, $2, $3, $6}
CBEGIN
D{print}
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting curly braces causing syntax errors.
Using 'print' without braces.
4fill in blank
hard

Fill both blanks to filter cron logs for a specific user and command.

Linux CLI
grep '[1]' /var/log/cron | grep '[2]'
Drag options to blanks, or click blank then click option'
Ausername
Broot
Cbackup.sh
Dcron
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'username' literally instead of the actual user.
Filtering by 'cron' twice which is redundant.
5fill in blank
hard

Fill all three blanks to create a dictionary of commands and their run counts from cron logs.

Linux CLI
awk '{print $6}' /var/log/cron | sort | uniq -c | awk '[1]' | sort -nr > [2] && cat [3]
Drag options to blanks, or click blank then click option'
A{print $2, $1}
Bcron_summary.txt
D{print $1, $2}
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping fields in print causing wrong output order.
Using different file names inconsistently.