Linux-scp命令实现Linux之间文件或者目录的复制
1、scp命令本地复制远端:
1.1 复制文件
命令格式:
scp local_file remote_username@remote_ip:remote_folder 或者
scp local_file remote_username@remote_ip:remote_file 或者
scp local_file remote_ip:remote_folder 或者
scp local_file remote_ip:remote_file
示例:
[look@192.168.0.112] scp test.txt read@192.168.0.113:/home/read/
或者
[look@192.168.0.112] scp test.txt read@192.168.0.113:/home/read/test2.txt
1.2 复制目录
命令格式:
scp -r local_folder remote_username@remote_ip:remote_folder 或者
scp -r local_folder remote_ip:remote_folder
示例:
[look@192.168.0.112] scp /home/look/ read@192.168.0.101:/home/read
2、scp命令远端复制到本地:
命令格式:
scp 远端用户名@远端ip:远端文件 本地目录
示例:
[look@192.168.0.122 ~] scp read@192.168.0.123:/home/read/test.txt /home/look/
3、免密scp文件/目录传输:
参考:
【1】Linux公社,https://www.linuxidc.com/Linux/2014-09/107127.htm