Linux命令---scp

注意scp只能在linux操作系统平台上,要想在linux与window平台上传文件或者目录,下载一个winscp软件或者下载一个sshsecure shell软件安装在window上即可,非常方便,直接拖拉就行。

1.上传本机文件到远程服务器

 scp 用户名/file_name   user_name@remote_ip:remote_path/

2.上传本机目录到远程服务器

 scp -r 用户名/fold_name user_name@remote_ip:remote_path/

3.拷贝远程服务器文件到本机

  scp 用户名@remote_ip:remote_path/file_name  local_path/

4.拷贝远程服务器目录到本机

  scp -r 用户名@remote_ip:remote_path/folder_name local_path/

5.拷贝远端A服务器文件到另外一台B服务器

scp A机器文件路径(加文件名) 用户名@B机器ip:B机器目录保存路径

6.拷贝远端A服务器目录及其子目录到另外一台B服务器

scp -r A机器目录路径 用户名@B机器ip:B机器目录保存路径

出现not a regular file 错误 是因为复制的不是一个文件而是一个文件夹,需要加-r 参数

scp -r /home/files [email protected]:/home/files

猜你喜欢

转载自my.oschina.net/u/2353881/blog/1824713