scp command is used to transfer the files(directories) from one unix machine to another.Port 22 is used for scp.
Login to machine linux1 and you want to tranfer the file /opt/testfile to the /home/user1/ directory in machine linux2
#scp /opt/testfile user1@linux2:/home/user1/
If you want to copy the directory /opt/testdirectory then
#scp -r /opt/testdirectory user1@linux2:/home/user1/
The options for scp are
-p
Preserves the modification and access times, as well as the permissions of the source-file in the destination-file
-q
Do not display the progress bar
-r
Recursive, so it copies the contents of the source-file (directory in this case) recursively
-v
Displays debugging messages
Login to machine linux1 and you want to tranfer the file /opt/testfile to the /home/user1/ directory in machine linux2
#scp /opt/testfile user1@linux2:/home/user1/
If you want to copy the directory /opt/testdirectory then
#scp -r /opt/testdirectory user1@linux2:/home/user1/
The options for scp are
Scp command in unix or linux works only when ssh command is installed. Scp uses ssh to authenticate.
ReplyDeleteYes. SSH package is to be installed.
Delete