Backing Up Your Linux Box Using Scripts
- Which command is commonly used to create a
compressed archive of files in Linux?
A) zip
B) tar
C) gzip
D) cp
Correct Answer: B)
tar
- What option would you use with the tar command
to create a compressed archive?
A) -c
B) -x
C) -t
D) -z
Correct Answer: A)
-c (and typically -z for gzip compression)
- Which of the following is a common file
extension for a tarball created with gzip compression?
A) .zip
B) .tar.gz
C) .tar.bz2
D) .rar
Correct Answer: B)
.tar.gz
- In a backup script, which command would
you use to copy files and directories recursively?
A) cp -r
B) cp -a
C) cp -R
D) All of the above
Correct Answer: D)
All of the above
- What is the purpose of the rsync command
in backup scripts?
A) To create compressed archives
B) To synchronize files and directories between two locations
C) To copy files without preserving permissions
D) To delete files
Correct Answer: B)
To synchronize files and directories between two locations
- Which of the following is a common way to
schedule a backup script to run automatically?
A) cron
B) at
C) systemd timers
D) All of the above
Correct Answer: D)
All of the above
- What command would you use to view the
contents of a tar archive without extracting it?
A) tar -xvf
B) tar -tvf
C) tar -cvf
D) tar -tf
Correct Answer: B)
tar -tvf
- In a backup script, which command would
you use to log the output of the backup process to a file?
A) > logfile.txt
B) >> logfile.txt
C) 2> logfile.txt
D) All of the above
Correct Answer: D)
All of the above (depending on the desired logging behavior)
- Which of the following is a good practice
when writing a backup script?
A) Hardcoding paths
B) Using absolute paths for files and directories
C) Ignoring error handling
D) Not documenting the script
Correct Answer: B)
Using absolute paths for files and directories
- What is the purpose of the --delete option
in the rsync command?
A) To delete files from the source
B) To delete files from the destination that are not present in the
source
C) To delete the backup after completion
D) To delete old backups
Correct Answer: B)
To delete files from the destination that are not present in the source
No comments:
Post a Comment
If you have any doubts, please let me know