做个记录,首先两台机器间要互通。
1. 将本地服务器的文件夹/文件拷贝到远程服务器上
语法:
scp -r -P port local_folder/remote_file remote_username@remote_ip:remote_folder
示例:
[root@zwzf-cwy-lzy-7-new upload]# scp -r -P 49622 /opt/upload/1011.txt yyuser@10.16.23.149:/opt/upload/
yyuser@10.16.23.149's password:
1011.txt 100% 1270KB 35.7MB/s 00:00
2. 拷贝本地文件到远程服务器,并重命名文件
语法:
scp -r -P port local_file remote_username@remote_ip:remote_folder/remote_file
示例:
[root@zwzf-cwy-lzy-7-new upload]# scp -r -P 49622 /opt/upload/1011.txt yyuser@10.16.23.149:/opt/upload/1111.txt
yyuser@10.16.23.149's password:
1011.txt 100% 1270KB 39.8MB/s 00:00
[root@zwzf-cwy-lzy-7-new upload]#
3. 拷贝远程服务器上的文件夹到本地服务器的目录下
语法:
scp -r -P port remote_username@remote_ip:remote_folder local_folder
示例:
[root@zwzf-cwy-lzy-7-new upload]# scp -r -P 49622 yyuser@10.16.23.149:/opt/upload/HDTool /opt/upload
yyuser@10.16.23.149's password:
gov.df.fap.hdtools-1.0.jar 100% 3393KB 34.1MB/s 00:00
╩╣╙├╦╡├ў.txt 100% 1133 439.2KB/s 00:00
hardwareInfo-JDK.bat 100% 291 121.8KB/s 00:00
hardwareInfo-JDK.sh 100% 241 116.0KB/s 00:00
hardwareInfo.bat 100% 133 63.8KB/s 00:00
hardwareInfo.sh 100% 94 46.4KB/s 00:00
hardware.info 100% 45 23.0KB/s 00:00
[root@zwzf-cwy-lzy-7-new upload]#
4. 拷贝远程服务器上的文件到本地服务器上,并指定新的文件名称
语法:
scp -r -P port remote_username@remote_ip:remote_folder/remote_file local_folder/local_file
示例:
[root@zwzf-cwy-lzy-7-new upload]# scp -r -P 49622 yyuser@10.16.23.149:/opt/upload/restart.sh /opt/upload/ppp.sh
yyuser@10.16.23.149's password:
restart.sh 100% 300 106.4KB/s 00:00
[root@zwzf-cwy-lzy-7-new upload]#
手机扫一扫
移动阅读更方便
你可能感兴趣的文章