[root@rhel1 ~]# scp -P 3545 /tmp/name.txt root@RHEL2:/tmp/ root@rhel2's password: name.txt 100% 57KB 56.9KB/s 00:00 [root@rhel1 ~]#
SCP Example 7: copying multiple files at once.
In this type of scp example we will copying multiple files at one go. Lets say you have file called “ftp-0.17-51.1.el6.x86_64.rpm” and “name.txt” on the server RHEL2 at the location /tmp .
and you want to copy this to local directory /root on the server “rhel1”. Then give following command from the server rhel1.
[root@rhel1 ~]# scp -pr root@RHEL2:/tmp/\{ftp-0.17-51.1.el6.x86_64.rpm,name.txt} /root/ root@rhel2's password: ftp-0.17-51.1.el6.x86_64.rpm 100% 57KB 56.9KB/s 00:00 name.txt 100% 57KB 56.9KB/s 00:00 [root@rhel1 ~]#
SCP Example 8: Compressing files during transfer.
In this type of scp example we will be compressing the files over a network. Once files reached at the destination it will get uncompress automatically. So this scp example method along with compression help us to reduce time duration for file transfer.
[root@rhel1 ~]# scp -C /tmp/name.txt root@RHEL2:/tmp/ root@rhel2's password: name.txt 100% 57KB 56.9KB/s 00:00 [root@rhel1 ~]#
SCP Example 9: Copying file passwordless.
You know that, while doing scp from one server to another server you need to enter password. What if you want to do it without entering the password. Yes this is possible, In this scp example we will doing passwordless scp. For this you need to do some sort of configuration, Please follow this link for the same. Once you are done with the configuration simply enter the command at this time you do not need to enter the password!!!
[root@rhel1 tmp]# scp name.txt root@RHEL2:/tmp/ name.txt 100% 57KB 56.9KB/s 00:00 [root@rhel1 tmp]#
Leave a Reply