SCP stands for Secure Copy Protocol. It is used to securely transfer files between computers over a network using SSH.
Click to reveal answer
beginner
Write the basic SCP command to copy a file named report.txt from your local machine to a remote server at user@server.com in the /home/user/ directory.
The command is: scp report.txt user@server.com:/home/user/ This copies report.txt from your local machine to the remote directory.
Click to reveal answer
intermediate
How do you copy a directory and all its contents using SCP?
Use the -r option to copy directories recursively. For example: scp -r myfolder user@server.com:/home/user/ This copies the entire myfolder directory and its contents.
Click to reveal answer
beginner
What happens if you omit the destination path in an SCP command when copying to a remote server?
If you omit the destination path, SCP copies the file to the remote user's home directory by default.
Click to reveal answer
beginner
How can you copy a file from a remote server to your local machine using SCP?
Use SCP with the remote file as the source and local path as the destination. For example: scp user@server.com:/home/user/report.txt ./ This copies report.txt from the remote server to your current local directory.
Click to reveal answer
Which SCP option allows copying directories recursively?
A-d
B-r
C-p
D-c
✗ Incorrect
The -r option tells SCP to copy directories and their contents recursively.
What protocol does SCP use to secure file transfers?
ASSH
BFTP
CHTTP
DTelnet
✗ Incorrect
SCP uses SSH (Secure Shell) to encrypt and secure file transfers.
What is the default destination directory if none is specified in SCP when copying to a remote server?
AUser's home directory
B/root
C/tmp
D/var
✗ Incorrect
If no destination path is given, SCP copies files to the remote user's home directory.
How do you copy a file named data.csv from a remote server to your local machine?
Ascp data.csv user@server.com:/home/user/
Bscp ./data.csv user@server.com:/home/user/
Cscp user@server.com:/home/user/data.csv ./
Dscp user@server.com:data.csv ./
✗ Incorrect
To copy from remote to local, specify the remote file path first, then local destination.
Which of these is NOT a valid SCP command?
Ascp file.txt user@host:/path/
Bscp -r folder user@host:/path/
Cscp user@host:/path/file.txt ./
Dscp -x file.txt user@host:/path/
✗ Incorrect
There is no -x option in SCP; this makes the command invalid.
Explain how to use SCP to transfer a directory from your local machine to a remote server.
Think about copying folders and how SCP secures the transfer.
You got /5 concepts.
Describe the difference between copying files to a remote server and copying files from a remote server using SCP.
Focus on which side (local or remote) comes first in the command.
You got /4 concepts.
Practice
(1/5)
1. What does the scp command do in Linux?
easy
A. Changes file permissions
B. Compresses files into a zip archive
C. Securely copies files between local and remote machines
D. Displays the contents of a file
Solution
Step 1: Understand the purpose of scp
The scp command is designed to securely transfer files between computers over a network.
Step 2: Compare with other options
Options A, B, and C describe different commands: permission changes, compression, viewing files, which are unrelated to scp.
Final Answer:
Securely copies files between local and remote machines -> Option C
2. Which of the following is the correct syntax to copy a file file.txt from your local machine to a remote server server.com under user alice in the directory /home/alice/?
easy
A. scp file.txt alice@server.com:/home/alice/
B. scp alice@server.com:/home/alice/ file.txt
C. scp /home/alice/file.txt alice@server.com:
D. scp file.txt /home/alice/alice@server.com
Solution
Step 1: Identify source and destination in scp syntax
The syntax is scp source destination. Here, file.txt is local source, and alice@server.com:/home/alice/ is remote destination.
Step 2: Check each option
scp file.txt alice@server.com:/home/alice/ correctly places local file first and remote path second. scp alice@server.com:/home/alice/ file.txt reverses source and destination. scp /home/alice/file.txt alice@server.com: uses remote path as source incorrectly. scp file.txt /home/alice/alice@server.com has wrong path format.
Final Answer:
scp file.txt alice@server.com:/home/alice/ -> Option A
Hint: Local file first, remote user@host:path second [OK]
Common Mistakes:
Swapping source and destination
Missing colon after remote host
Incorrect path order
3. What will be the output or result of this command? scp -r alice@server.com:/var/logs ./backup_logs Assuming you have access and the remote directory exists.
medium
A. Copies the remote /var/logs directory recursively to local ./backup_logs folder
B. Copies only files inside /var/logs but not subdirectories
C. Throws an error because -r cannot be used with remote paths
D. Deletes the local ./backup_logs directory
Solution
Step 1: Understand the -r option in scp
The -r flag means recursive copy, so it copies directories and their contents.
Step 2: Analyze the command effect
The command copies the remote directory /var/logs from user alice on server.com to the local folder ./backup_logs. This is valid and copies all files and subfolders.
Final Answer:
Copies the remote /var/logs directory recursively to local ./backup_logs folder -> Option A
Quick Check:
scp -r remote:/path local copies folders recursively [OK]
Hint: Use -r to copy folders recursively from remote [OK]
Common Mistakes:
Thinking -r only copies files, not folders
Believing -r is invalid with remote paths
Confusing copy direction
4. You run this command to copy a file from remote to local: scp alice@server.com/home/alice/file.txt ./ But it fails with an error. What is the likely problem?
medium
A. scp cannot copy files from remote to local
B. Missing colon after the remote host before the path
C. Local path ./ is invalid
D. User alice does not have permission to copy files
Solution
Step 1: Check the remote path syntax
Remote paths must be specified as user@host:/path with a colon after the host. The command misses the colon after server.com.
Step 2: Understand the error cause
Without the colon, scp treats the whole string as a local path, causing failure.
Final Answer:
Missing colon after the remote host before the path -> Option B
Quick Check:
Remote path needs colon after host [OK]
Hint: Always put colon after remote host in scp paths [OK]
Common Mistakes:
Omitting colon after remote host
Assuming local path is wrong
Thinking scp can't copy remote files
5. You want to copy multiple files file1.txt and file2.txt from your local machine to the remote directory /data/uploads on server example.com as user bob. Which command correctly does this in one line?
hard
A. scp file1.txt,bob@example.com:/data/uploads/ file2.txt
B. scp file1.txt file2.txt -r bob@example.com:/data/uploads/
C. scp bob@example.com:/data/uploads/ file1.txt file2.txt
D. scp file1.txt file2.txt bob@example.com:/data/uploads/
Solution
Step 1: Understand copying multiple files with scp
scp supports copying multiple files by listing them before the destination path.
Step 2: Analyze each option
scp file1.txt file2.txt bob@example.com:/data/uploads/ correctly lists both files followed by remote destination. scp file1.txt file2.txt -r bob@example.com:/data/uploads/ misplaces the -r flag after the sources, treating "-r" as a non-existent source file. scp bob@example.com:/data/uploads/ file1.txt file2.txt reverses source and destination. scp file1.txt,bob@example.com:/data/uploads/ file2.txt has invalid syntax with comma.
Final Answer:
scp file1.txt file2.txt bob@example.com:/data/uploads/ -> Option D
Quick Check:
List files then remote destination [OK]
Hint: List all files first, then remote destination [OK]
Common Mistakes:
Misplacing the -r flag after source files
Swapping source and destination
Incorrect file list syntax
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.