Or copy link
Copy link
SCP (Secure Copy Protocol) is a command that securely transfers files from a local to a remote server through SSH. During copying files, SCP keeps your data safe and secure through encryption. Moreover, you can move multiple files from a local to a remote server.
Through this guide, we will explore how to copy files from a local to a remote server using SCP Command on Linux (Ubuntu 22.04).
Also, read How To Connect To Linux Server Remotely
You can securely copy or transfer files from a local to a remote server through SCP on Ubuntu 22.04 using the following guide.
Check SSH Status
Before using SCP to copy files to a remote server, ensure SSH is active on your Ubuntu system. You can check the status of SSH using the following command:
sudo systemctl status ssh
The status command will display the active or inactive status of the SSH service on your screen, along with information about the active port (i.e., port 22 or 2222) of a remote server.
Transfer Single File
To transfer a file from your local to a remote server via SCP, execute the command:
scp -P 2222 ~/Documents/backup-folder/file.txt [email protected]:~/Downloads
A brief explanation of the above command is:
In short, this command will transfer “file.txt” from the local to the remote directory, such as /Downloads.
Transfer Two or More Files
The SCP also allows you to transfer two or more files. First, navigate to the directory containing the files you want to copy:
cd ~/Documents/backup-folder/
Now, run the command using the following syntax to copy files to the remote directory:
scp -P 2222 file.txt image.jpg [email protected]:~/Downloads
The list of copied files will be displayed on your terminal screen after the successful execution of the command.
Unleash smooth performance with an Ubuntu VPS!
Embark on a new level of dependability and adaptability – opt for Ubuntu VPS for a robust and customized hosting solution.
Copy Files From Different Paths
You can also copy files from different paths to the remote directory through the command:
scp -P 2222 ~/Documents/backup-folder/file.txt ~/Documents/sample.doc [email protected]:~/Downloads
Copy an Entire Directory
To copy the entire directory, such as backup-folder, from your local machine to the remote directory, add the “-r” option with the SCP command:
scp -r -P 2222 ~/Documents/backup-folder [email protected]:~/Downloads
The above command will copy all the contents of the backup-folder to the ~/Downloads directory on the remote server.
Verify Files After Transfer
To confirm whether the file(s) has been copied to the remote server, run the command:
ssh [email protected] -p 2222 "ls -l ~/Downloads/"
The list of copied files on your screen indicates that you have successfully transferred files with the scp command on Ubuntu 22.04.
The SCP command facilitates the secure transfer of files from a local to a remote server. Its syntax, “scp [options] [destination],” can be executed within the Ubuntu terminal. This post provided a comprehensive guide on copying files from local to remote servers with the scp command on the Ubuntu 22.04 system.
We appreciate your presence at Ultahost! Your trust is invaluable to us. Discover seamless VPS hosting solutions with Ultahost, where reliability converges with innovation. Elevate your online presence with us – because your success is our top priority!
SCP stands for Secure Copy Protocol. It is a command-line tool that allows secure and encrypted file transfer between a local host and a remote server or between two remote servers.
SCP is a Unix-based tool to transfer file(s) between local and remote servers via SSH.
Yes, SCP enables you to securely transfer one or multiple files to a remote server through the command: scp [options] [destination]
You can check if scp is installed by opening a terminal and typing the following command: scp –version. If installed, it will display the version information.
Ubuntu, a popular Linux distribution, provides a robust...
SQLite is a lightweight, self-contained, and serverless...
MongoDB, the popular NoSQL database, offers a powerful ...
Apache Virtual Hosts offer a powerful way to manage mul...
The .deb packages are the standard format for installin...
As a Ubuntu user, managing system logs can be a dauntin...
Save my name, email, and website in this browser for the next time I comment.
Δ