jingxinxin / tiankeng

记录程序猿开发过程中已经遇到的各种坑,再记录解决方法 / Record the various pits that have been encountered during the development process, and then record the solution.
2 stars 0 forks source link

怎么从命令行中把本地文件复制到服务器上? #3

Open jingxinxin opened 6 years ago

jingxinxin commented 6 years ago

采用scp命令

  1. 将本地文件拷贝到 远程

scp文件名 --用户名 @IP或者名称 :远程路径

scp /home/test.ora root@10.138.130.29:/home/root

  1. 从远程将文件拷回本地

    scp --用户名 @IP或者名称 :文件名 本地路径

scp root@10.138.130.29:/home/root /home/test.ora

  1. 将本地目录拷贝到远程

    scp -r 目录名 用 户名 @IP或者名称 :远程路径

scp -r /home/test.ora root@10.138.130.29:/home/root

  1. 从远程将目录拷回 本地

    scp -r 用户名 @IP或者名称 :目录名 本地路径

scp -r root@10.138.130.29:/home/root /home/