how to use scp command with its examples

The scp command is used to securely transfer files between local and remote servers. it uses the SSH protocol to establish a secure connection and transfer files between the them.

  • About scp: A secure and remote copy program
  • Comes From : openssh-clients-5.3p1
  • Configuration Files:
  • Path: /usr/bin/scp


1. To copy the files from source (current directory) to destination

$ scp file.txt

 2. To force scp to use protocol 1

$ scp -1 file.txt

 3. To force scp to use protocol 2

$ scp -1 file.txt

 4. To force scp to use IPv4 addresses only

$ scp -4 file.txt

 5. To force scp to use IPv6 addresses only

$ scp -6 file.txt

 6. To enable the compression while copying

$ scp -C file.txt

 7. To specify the cipher to encrypt the data

$ scp -c cipher file.txt

 8. To specify the file from which the identity (private key) for public key authentication is read

$ scp -i file file.txt

 9. To limit the used bandwidth

$ scp -l 10 file.txt

 10. To to pass options to ssh in the format used in ssh_config

$ scp -o ssh_option file.txt

 11. To specify the port to connect to

$ scp -P 20 file.txt 

12. To preserve modification times, access times, and modes from the original file

$ scp -p file.txt

 13. To disable the progress meter as well as warning and diagnostic messages

$ scp -q file.txt

14. To recursively copy entire directories

$ scp -r /tmp/

 15. To name of program to use for the encrypted connection

$ scp -S program file.txt

 16. To run in verbose mode

$ scp -v file.txt


Related Commands: rcp, sftp, ssh, ssh-add, ssh-agent, ssh-keygen, ssh_config, sshd 

One thought on “how to use scp command with its examples

  1. This is a brilliant writing and very pleased to find this site. I couldn’t discover to much different information on your blog. I will surely be back again to look at some other important posts that you have in future.

    linux scp

Leave a Reply

Your email address will not be published. Required fields are marked *