0
0
Linux CLIscripting~20 mins

Backup strategies in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Backup Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this incremental backup command?
Consider the following command that creates an incremental backup using rsync. What will be the output message shown after running it?
Linux CLI
rsync -av --link-dest=/backup/full /home/user/ /backup/incremental
A
sending incremental file list
error: link-dest directory not found
B
sending incremental file list
backup completed successfully
C
sending incremental file list
created directory /backup/incremental
file1
file2
Drsync: command not found
Attempts:
2 left
💡 Hint
Think about what --link-dest does and what rsync outputs when it runs successfully.
🧠 Conceptual
intermediate
1:30remaining
Which backup strategy minimizes storage by saving only changed data?
Among these backup strategies, which one saves storage space by only storing changes since the last backup?
AIncremental backup
BDifferential backup
CFull backup
DMirror backup
Attempts:
2 left
💡 Hint
Think about which backup type saves only the changes since the last backup, not the entire data.
🔧 Debug
advanced
2:30remaining
Why does this backup script fail to create a compressed archive?
This script is intended to create a compressed tar archive of /var/log but fails with an error. What is the cause?
#!/bin/bash
backup_dir=/backup
filename=logs_backup.tar.gz
tar -czvf $backup_dir/$filename /var/log
AThe variable filename is not quoted, causing word splitting.
BThe tar command is missing the -f option to specify the filename.
CThe script lacks execute permission, so it cannot run.
DThe backup directory /backup does not exist, so tar cannot write the archive.
Attempts:
2 left
💡 Hint
Check if the directory where the archive is saved exists.
🚀 Application
advanced
2:00remaining
Which command creates a daily rotating backup with 7 days retention using rsnapshot?
You want to configure rsnapshot to keep daily backups and automatically rotate them, keeping backups for 7 days. Which command below correctly triggers this behavior?
Arsnapshot -c /etc/rsnapshot.conf daily
Brsnapshot -t daily
Crsnapshot -r 7 daily
Drsnapshot daily
Attempts:
2 left
💡 Hint
The configuration file controls retention and intervals; the command triggers the snapshot.
📝 Syntax
expert
3:00remaining
What error does this backup script produce and why?
Analyze this bash script snippet intended to copy files and create a log. What error will it produce?
#!/bin/bash
backup_src="/home/user/data"
backup_dest="/mnt/backup"
cp -r $backup_src $backup_dest > backup.log 2>&1 &
wait $!
echo "Backup completed" >> backup.log
ANo error; the script runs and logs output correctly.
Bwait: no child processes; because the background job finished before wait.
Ccp: missing destination file operand after /mnt/backup; due to missing trailing slash.
DSyntax error: unexpected token near '&'
Attempts:
2 left
💡 Hint
Consider how the shell handles background jobs and the wait command.