0
0
Linux CLIscripting~15 mins

SCP for file transfer in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Secure File Transfer Using SCP
📖 Scenario: You need to securely copy files from your local computer to a remote server using the scp command. This is common when you want to upload your work or backup files safely over the network.
🎯 Goal: Learn how to use the scp command to transfer a file from your local machine to a remote server with a specific username and destination path.
📋 What You'll Learn
Use the scp command to copy files
Specify the source file path exactly
Specify the remote username and server address
Specify the destination path on the remote server
💡 Why This Matters
🌍 Real World
SCP is widely used by system administrators and developers to securely transfer files between computers over a network.
💼 Career
Knowing how to use SCP is essential for roles involving server management, deployment, and secure file handling.
Progress0 / 4 steps
1
Prepare the local file to transfer
Create a file called report.txt in your current directory with the exact content: Monthly sales report. Use the echo command to do this.
Linux CLI
Need a hint?

Use echo followed by the text in quotes, then redirect it to report.txt using >.

2
Set the remote server details
Create a variable called remote_user and set it to admin. Create another variable called remote_host and set it to 192.168.1.100.
Linux CLI
Need a hint?

Assign the username and IP address to variables using = without spaces.

3
Write the SCP command to transfer the file
Use the scp command to copy report.txt from your local machine to the remote server. Use the variables remote_user and remote_host for the username and server. Copy the file to the remote path /home/admin/reports/.
Linux CLI
Need a hint?

Use scp followed by the source file, then ${remote_user}@${remote_host}:/home/admin/reports/ as the destination.

4
Verify the file transfer command output
Run the script and show the output of the scp command. The output should show the progress of copying report.txt to the remote server.
Linux CLI
Need a hint?

When you run scp, it shows the file name and progress. You only need to show that output contains report.txt.