0
0
Linux CLIscripting~20 mins

SCP for file transfer in Linux CLI - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
SCP Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
SCP command output for copying a file to a remote server
What is the output of this command when copying a file named report.txt to the remote server server.example.com under user alice in the home directory?
Linux CLI
scp report.txt alice@server.example.com:~
ANo such file or directory: report.txt
BPermission denied (publickey).
Creport.txt 100% 1.2KB 1.2KB/s 00:01
Dscp: command not found
Attempts:
2 left
💡 Hint
Think about what happens when the file exists and you have access to the remote server.
💻 Command Output
intermediate
2:00remaining
SCP command output when copying a directory recursively
What output will this command produce when copying the local directory project recursively to the remote server backup.example.com under user bob?
Linux CLI
scp -r project bob@backup.example.com:/home/bob/
A
project/file1.txt 100% 5KB 5KB/s 00:00
project/file2.txt 100% 10KB 10KB/s 00:01
Bscp: -r: command not found
CPermission denied (password).
DNo such file or directory: project
Attempts:
2 left
💡 Hint
Remember that -r copies directories recursively and shows progress for each file.
🔧 Debug
advanced
2:00remaining
Identify the error in this SCP command
What error will this command produce and why? scp file.txt user@remote:/path/to/destination/
Linux CLI
scp file.txt user@remote:/path/to/destination/
Ascp: file.txt: No such file or directory
BConnection timed out
Cscp: /path/to/destination/: Permission denied
Dssh: Could not resolve hostname remote: Name or service not known
Attempts:
2 left
💡 Hint
Check the hostname format in the command.
🧠 Conceptual
advanced
1:30remaining
Understanding SCP command options
Which SCP option is used to limit the bandwidth used during file transfer?
A-l
B-r
C-p
D-v
Attempts:
2 left
💡 Hint
Think about which option controls speed or limits usage.
🚀 Application
expert
2:30remaining
Automate SCP file transfer with password prompt
You want to automate copying backup.tar.gz to server.example.com under user admin but want to be prompted for the password securely each time. Which command achieves this?
Ascp -o PasswordAuthentication=no backup.tar.gz admin@server.example.com:/backups/
Bscp backup.tar.gz admin@server.example.com:/backups/
Cscp -i ~/.ssh/id_rsa backup.tar.gz admin@server.example.com:/backups/
Dscp -P 22 backup.tar.gz admin@server.example.com:/backups/
Attempts:
2 left
💡 Hint
Which command uses password prompt by default?