Linux - Secure copy scp example, Scp multiple files in one time

Secure copy scp example

What is scp?

SCP stands for Secure copy, scp is a linux command which is used to copy files over ssh from one server to the other. scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.

Copy the file foo.txt from a remote machine to local machnie
 # scp username@remotehost:foo.txt /local/directory  

Copy the file foo.txt from the local machine to a remote machine
 # scp foo.txt username@remotehost:/var/www/html 
In the above example we try to copy the file from our local machine to remote machin. While trying to copy the file the remote machine will prompt for a password if you have not done ssh-keygen.

Copy the directory foo from the local host to a remote hosts directory bar
 # scp -r foo 

Copy the file foo.txt from the local host to a remote host using port 5896
 # scp -P 5896 foo.txt username@remotehost:/var/www/html 

Copying the files foo.txt and bar.txt from the local host to your home directory on the remote host
 # scp foo.txt bar.txt username@remote_machine:~

Copy multiple files from the remote machine to your current directory on the local Machine
 # scp username@remotehost:/var/www/html/\{my.txt,foo.txt,bar.txt\} .

 # scp username@remotehost:~/\{home.txt,love.txt\} .

By default scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option -c blowfish in the command line.
 # scp -c blowfish foo.txt username@remotehost:~  
It is often suggested that the -C option for compression should also be used to increase speed. The effect of compression, however, will only significantly increase speed if your connection is very slow. Otherwise it may just be adding extra burden to the CPU.

An example of using blowfish and compression
 # scp -c blowfish -C my-file.txt username@remotehost:~  

The topic on Linux - Secure copy scp example is posted by - Math

Hope you have enjoyed, Linux - Secure copy scp exampleThanks for your time

Tech Bluff