Your destination for complete Tech news

How to copy files and folders using SCP between server and local

2.42K 0
< 1 min read

The SCP (Secure Copy Protocol) command is a powerful and secure way to transfer files between your local computer and a remote server or even between two servers. It uses SSH (Secure Shell) for data transfer, ensuring your files remain protected during the process.

Copy a File from Server to Local Computer using SCP

To copy a single file from a remote server to your local machine, use the following syntax:

scp [email protected]:/path/to/your/file /path/to/your/local/filename

To copy a folder, add -r flag which will copy all files inside the folder recursively

scp -r [email protected]:/path/to/your/folder /path/to/your/destination

Copy a File from Local Computer to Remote Server

To upload a file from your local computer to a remote server:

scp /path/to/your/local/file [email protected]:/path/to/remote/directory

Copy Files Between Two Remote Servers

You can also transfer files directly between two servers without downloading them to your local computer first:

scp [email protected]:/path/to/file [email protected]:/path/to/destination

This command ensures that every file and subfolder inside the target directory is transferred securely.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.