Sunday, December 01, 2013

SCP

1) send a file to a remote computer with scp command 


$ scp MyTestFile1.txt psqa@10.9.28.95:.

psqa@10.9.28.95's password:

MyTestFile1.txt                                                                                            100%   60KB  60.0KB/s   00:00
psqa@psqa-Precision-WorkStation-T3500:~$

Verifying that the file has been copied successfully
psqa@psqa-Precision-WorkStation-T3500:~$ ssh psqa@10.9.28.95
psqa@10.9.28.95's password:
Welcome to Ubuntu 11.10 (GNU/Linux 3.0.0-12-generic i686)

 * Documentation:  https://help.ubuntu.com/

492 packages can be updated.
232 updates are security updates.

New release '12.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Sun Dec  1 12:32:09 2013 from psqa-x7dvl.local
psqa@psqa-X7DVL:~$ ls
Desktop  Documents  Downloads  examples.desktop  Music  MyTestFile1.txt  Pictures  Public  Templates  Videos
psqa@psqa-X7DVL:~$ ls -l MyTestFile1.txt
-rw-rw-r-- 1 psqa psqa 61440 2013-12-01 13:14 MyTestFile1.txt
psqa@psqa-X7DVL:~$

=============================================

2) Send multiple files at once to a remote computer

$ scp MyTestFile1.txt MyTestFile2.txt psqa@10.9.28.95:
psqa@10.9.28.95's password:
MyTestFile1.txt                                                                                            100%   60KB  60.0KB/s   00:00
MyTestFile2.txt                                                                                            100%   60KB  60.0KB/s   00:00

$ scp MyTestFile1.txt MyTestFile2.txt psqa@10.9.28.95:.
psqa@10.9.28.95's password:
MyTestFile1.txt                                                                                            100%   60KB  60.0KB/s   00:00
MyTestFile2.txt                                                                                            100%   60KB  60.0KB/s   00:00
psqa@psqa-Precision-WorkStation-T3500:~$

==================================================

3) Send multiple files at once using "*" to a 

remote computer

$ scp * psqa@10.9.28.95:.

psqa@10.9.28.95's password:
MyTestFile1.txt                                                                                            100%   60KB  60.0KB/s   00:00
MyTestFile2.txt                                                                                            100%   60KB  60.0KB/s   00:00
psqa@psqa-Precision-WorkStation-T3500:~/anu$

========================================================

4) scp command used to transfer a directory recursively to a remote 

computer (anu is the folder name)




scp -r /root/portal root@10.131.16.165:.



$ scp -r anu psqa@10.9.28.95:.

psqa@10.9.28.95's password:
MyTestFile1.txt                                                                                            100%   60KB  60.0KB/s   00:00
MyTestFile2.txt                                                                                            100%   60KB  60.0KB/s   00:00

Verifying that the folder has been copied

psqa@psqa-Precision-WorkStation-T3500:~$ ssh psqa@10.9.28.95
psqa@10.9.28.95's password:
Welcome to Ubuntu 11.10 (GNU/Linux 3.0.0-12-generic i686)

 * Documentation:  https://help.ubuntu.com/

492 packages can be updated.
232 updates are security updates.

New release '12.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Sun Dec  1 13:28:39 2013 from 10.20.10.150
psqa@psqa-X7DVL:~$ ls
anu  Desktop  Documents  Downloads  examples.desktop  Music  MyTestFile1.txt  MyTestFile2.txt  Pictures  Public  Templates  Videos
psqa@psqa-X7DVL:~$ cd anu/
psqa@psqa-X7DVL:~/anu$ ls
MyTestFile1.txt  MyTestFile2.txt

psqa@psqa-X7DVL:~/anu$

================================================
5) Retrieving a file from remote computer to the local computer

$ scp psqa@10.9.28.95:/home/psqa/MyTestFile1.txt .
psqa@10.9.28.95's password:
MyTestFile1.txt                                                                                            100%   60KB  60.0KB/s   00:00
psqa@psqa-Precision-WorkStation-T3500:~$ ls
about.html       download_script.php?src_id=7701  index.html.1     Public                    strx25-0.9.2.1.tar.bz2.4
centos-org.html  examples.desktop                 Music            strx25-0.9.2.1.tar.bz2    taglist.zip
Desktop          gettext.html                     mygettext.html   strx25-0.9.2.1.tar.bz2.1  Templates
Documents        helloworld.sh                    MyTestFile1.txt  strx25-0.9.2.1.tar.bz2.2  Videos
Downloads        index.html                       Pictures         strx25-0.9.2.1.tar.bz2.3  wget-log
psqa@psqa-Precision-WorkStation-T3500:~$