Article directory
scp introduction
scp is the abbreviation of secure copy, which is a command for remote copying files under Linux.
The scp transmission is encrypted, which may affect the speed slightly. In addition, scp is very resource-intensive and will not increase the system load much. In this regard, rsync is far behind it. Although rsync is faster than scp, when there are many small files, rsync will cause very high hard disk I/O, while scp basically does not affect the normal use of the system.
scp command scenario
1. Upload local files to the server
Operation command:
scp -P16781 /Users/allenpandas/scptest.txt [email protected]:/root/autodl-tmp/
Resolution:
Upload the local /Users/allenpandas/scptest.txt
file to the directory192.168.0.2
of the server ./root/autodl-tmp/
-P
: Set the remote port number, if it is not port 22, you need to add-P
parameters ./path/file
: The path and file name of the file to be uploadedroot
: The username of the remote server loginIP
: The IP address of the remote server/root/autodl-tmp/
: path to the remote server
2. Upload the local directory to the server
Operation command:
scp -r /Users/allenpandas/datasets/ [email protected]:/root/autodl-tmp/
Resolution: Upload the local /Users/allenpandas/datasets/
directory to 192.168.0.2
the server's /root/autodl-tmp/
directory .
3. Download the file from the server
Operation command:
scp [email protected]:/root/autodl-tmp/test.txt /Users/allenpandas/datasets/
Resolution:192.168.0.2
Download the file on the server /root/autodl-tmp/test.txt
to the local /Users/allenpandas/datasets/
directory .
4. Download directory from server
Operation command:
scp -r [email protected]:/root/autodl-tmp/datasets/ /Users/allenpandas/
Resolution:192.168.0.2
Download the directory on the server /root/autodl-tmp/datasets/
to the local /Users/allenpandas/
directory .