SCP – how to use it ?

Posted by

Utility mostly for Linux environments that allows files to be copied between systems using SSH connections on a network. By default, SSH protocol use port 22, but you can set any port to use it.

Pre-requisites:

1. Credentials for authentication.
2. Communication between servers.

Examples,

– local to remote server

[root@localhost]# scp /path/to/source-file user@host:/path/to/destination-folder/

– remote server to local

[root@localhost]# scp user@host:/path/to/source-file /path/to/destination-folder/

– remote server to remote server

[root@localhost]# scp user@server1:/path/to/source-file user@server2:/path/to/destination-folder/

– several files (local) to remote server

[root@localhost]# scp file1.txt file2.txt file3.txt user@host:/path/to/destination-folder/

– all folder content (local) to remote server

[root@localhost]# scp /path/to/folder/* user@host:/path/to/destination-folder/

– all folder content (local) by type [extension] to remote server

[root@localhost]# scp /path/to/folder/*.ext user@host:/path/to/destination-folder/

– copy file and limit the bandwith transfer to 500 kilobytes

[root@localhost]# scp -l 500 /path/to/source-file/filename.tar.gz user@host:/path/to/destination-folder/

– set specific port to copy files

[root@localhost]# scp -P 1234 /var/www/html.xml user@host:/path/to/destination-folder/

Note: The sintaxis between (remote/local) will depends on your needs. But you can use it (remote to local) (local to remote), try it, also, access the man page to understand more the behavior by typing “man scp“.

[root@localhost]# man scp

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s