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使用三重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:~