The scp command copies files between servers (computers) on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh.
scp Command
The correct syntax is as follows to copy all files including hidden dot files:$ scp -rp /path/to/source/. user@server2:/path/to/dest/
Where,
- -r : Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree trave
- -p : Preserves modification times, access times, and modes from the original file.
- /path/to/source/. : Appending a dot (.) symbol is very important when you specify /path/to/source as a source path. If you skip dot in path it will only copy normal files and scp will skip all hidden files.
rsync Command
I recommend that you use rsync command to copy files between Unix / Linux based servers and workstations.$ rsync -avzP /path/to/source/ user@server2:/path/to/dest/
OR
$ rsync -avzP /path/to/source/ user@192.168.1.5:/path/to/dest/
No comments:
Post a Comment