linux scp命令
嘻嘻发布于2020-02-18
最后更新于2020年2月4日
浏览scp允许在不同的主机之间复制文件。它使用ssh进行数据传输,并提供与ssh相同的身份验证和安全级别。
应用举例
- 从远程主机复制文件到本地
$ scp your_username@remotehost.edu:foobar.txt /some/local/directory
- 复制本地文件到远程主机
$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory
3.复制本地目录到远程主机
$ scp -r foo your_username@remotehost.edu:/some/remote/directory/bar
- 从一个主机复制到另外一个主机
$ scp your_username@rh1.edu:/some/remote/directory/foobar.txt \ your_username@rh2.edu:/some/remote/directory/
- 复制一个或者多个文件到远程主机
$ scp foo.txt bar.txt your_username@remotehost.edu:~
- 设置复制的端口
$ scp -P 2264 foobar.txt your_username@remotehost.edu:/some/remote/directory
7.将多个文件从远程主机复制到本地主机上的当前目录
$ scp your_username@remotehost.edu:~/\{foo.txt,bar.txt\} .
scp性能
默认情况下,scp使用三重des密码加密发送的数据。使用Blowfish可以提高速度。这可以通过在命令行中使用选项-c blowfish来实现。
$ scp -c blowfish some_file your_username@remotehost.edu:~
通常建议使用-C选项进行压缩,以提高速度。然而,只有在连接非常慢的情况下,压缩的效果才会显著提高速度。否则就会给CPU增加额外的负担。一个使用blowfish和压缩的例子:
$ scp -c blowfish -C local_file your_username@remotehost.edu:~