cp
用途:单机拷贝文件和文件夹
1.拷贝单个文件
cp [src file] [dst dir]
2.拷贝多个文件
cp [src file1] [src file2] [src file3] [dst dir]
3.拷贝文件夹
cp -r [src dir] [dst dir]
scp
用途:多机拷贝文件和文件夹
1.拷贝单个文件
scp [src file] [远程主机账号名]@[ip]:[dst dir]
输入远程主机账号的密码
2.拷贝多个文件
scp [src file1] [src file2] [src file3] [远程主机账号名]@[ip]:[dst dir]
输入远程主机账号的密码
3.拷贝文件夹
scp -r [src dir] [远程主机账号名]@[ip]:[dst dir]
输入远程主机账号的密码
rsync
用途:高级多机文件拷贝(重名覆盖和重名最新覆盖)
Use rsync, and pass -u if you want to only update files that are newer in the original directory,
or --ignore-existing to skip all files that already exist in the destination.
rsync -au /local/directory/ host:/remote/directory/
rsync -a --ignore-existing /local/directory/ host:/remote/directory/