0
0
Linux CLIscripting~20 mins

scp and rsync for file transfer in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
File Transfer 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 rsync command?
You run this command to copy files from your local folder to a remote server:

rsync -avz /home/user/docs/ user@remote:/backup/docs/

What will rsync display as output?
Linux CLI
rsync -avz /home/user/docs/ user@remote:/backup/docs/
AA simple message: 'Transfer complete' without file details
BOnly a progress bar with percentage and speed
CNo output unless there is an error
DA list of files copied with details and a summary of transferred bytes
Attempts:
2 left
💡 Hint
The -v option in rsync means verbose output.
💻 Command Output
intermediate
2:00remaining
What error does this scp command produce?
You run this command to copy a file from a remote server to your local machine:

scp user@remote:/path/to/file.txt /local/path/

But the remote path is incorrect. What error message will scp show?
Linux CLI
scp user@remote:/path/to/file.txt /local/path/
Ascp: /path/to/file.txt: No such file or directory
BPermission denied (publickey).
CConnection timed out during banner exchange
Dscp: /local/path/: Not a directory
Attempts:
2 left
💡 Hint
Check if the remote file path exists.
📝 Syntax
advanced
2:00remaining
Which rsync command correctly excludes all .log files during transfer?
You want to copy a folder but skip all files ending with .log. Which command does this correctly?
Arsync -av --exclude '*.log' /source /dest
Brsync -av --exclude '*.log' /source/ /dest/
Crsync -av --exclude='*.log' /source/ /dest/
Drsync -av --exclude=*.log /source/ /dest/
Attempts:
2 left
💡 Hint
The exclude pattern should be quoted to avoid shell expansion.
💻 Command Output
advanced
2:00remaining
What is the output of this scp command copying a directory?
You run:

scp -r /local/folder user@remote:/remote/folder

What output will scp produce?
Linux CLI
scp -r /local/folder user@remote:/remote/folder
ASyntax error: -r option not supported
BCopies all files and subfolders recursively, showing each file copied
CCopies only the folder without contents, no output
DCopies files but skips hidden files silently
Attempts:
2 left
💡 Hint
The -r option means recursive copy.
🚀 Application
expert
3:00remaining
Which rsync command synchronizes two folders and deletes files in destination missing from source?
You want to make /backup an exact copy of /data, removing any files in /backup that are not in /data. Which command does this?
Arsync -av --delete /data/ /backup/
Brsync -av /data/ /backup/
Crsync -av --remove-source-files /data/ /backup/
Drsync -av --delete-after /backup/ /data/
Attempts:
2 left
💡 Hint
The --delete option removes extra files in destination.