Tuesday, 4 July 2017

scp command examples in Linux

1) Transfer single file to remote host
scp abc.txt username@remote_ip:/remote_path/

2) Transfer multiple files to remote host
scp *.txt username@remote_ip:/remote_path/
scp /path/*.txt username@remote_ip:/remote_path/               
scp /path/* username@remote_ip:/remote_path/
scp abc.txt abc1.txt abc2.txt username@remote_ip:/remote_path/               

3) Copy single file from remote to local
scp username@remote_ip:/remote_path/abc.txt .
4) Copy multiple files from remote to local
scp username@remote_ip:/remote_path/*.txt .

5) Copy a directory to remote host
scp -r abc username@remote_ip:/remote_path/

6) Transfer single file to remote host in silent mode
scp -q /abc/xyz.txt username@remote_ip:/remote_path/

Note:- "-q" option is for silent mode and progress of command and error will not be displayed on monitor

7) Transfer single file to remote host via specific port
scp -P 922 /abc/xyz.txt username@remote_ip:/remote_path/

Note:- If port is not default then Port Number need to mentioned by "-P" option

8) Transfer faster by "-C" option for big file to remote host
scp -C -P 922 /abc/xyz.txt username@remote_ip:/remote_path/

Note:-"-C" option will compress files on the go. Compression is happen in the network only.
      When the file is arrived to the destination server, it will return into the original size.
9) Transfer files from one remote host to another remote host
scp username@remote_host1:/remote1_path/ username@remote_host2:/remote2_path/

10) Transfer a file with preserve file attributes
scp -p test.txt username@remote_ip:/remote_path/


  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

  2. Thanks for the given information you are providing content very usefull to users.
    Learn How to Work With Ref Cursor in ORACLE 12C For Beginner Actual cost of this course is 9,999/- But now Kuncham Software Solutions Pvt ltd is giving you Free access. Limited period offer Hurry-up Enroll Now at Udemy.

    Hurry-Up Enroll Now and get Free Access to the Entire Course


Cloning database with RMAN

Below are the steps to clone production database(primedb) to UAT database(clonedb)   STEP1 :- Check the both servers are able to connect ...