命令简单但是很实用
一,ssh上传文件
scp file username@hostIP:文件地址 例:
[root@BlackGhost ~]$ scp test.sql rooting@192.168.1.5:/var/www/rooting
rooting@192.168.1.5's password:
test.sql 100% 7884 7.7KB/s 00:00
[root@BlackGhost ~]$
二,ssh下载文件
scp username@hostIP:文件所在地址 文件目录 例:
[root@BlackGhost ~]$ scp rooting@192.168.1.5:/var/www/rooting/test.sql /home/root/database_bak/
rooting@192.168.1.5's password:
test.sql 100% 7884 7.7KB/s 00:00
[root@BlackGhost ~]$
scp -rp user1@host1:/filepath1 user2@host2:/filepath2
-p Preserves modification times, access times, and modes from the original file.
备份模式(修改时间、访问时间及modes)
-r Recursively copy entire directories.
递归地复制整个目录