📅  最后修改于: 2023-12-03 14:49:46.372000             🧑  作者: Mango
在 Shell 或 Bash 中,使用 scp 命令可以通过 SSH 协议在本地系统和远程系统之间进行文件传输。scp 命令支持从远程系统复制文件到本地系统,也支持将本地文件复制到远程系统。
scp [选项] <源文件> <目标文件>
以下是常用的 scp 命令选项:
-P
:指定远程 SSH 服务器的端口号。-l
:限制 SCP 命令的带宽,以 Kbit/s 为单位。-p
:保留文件的原始修改时间,访问时间和权限。-r
:递归复制目录及其内容。-v
:显示详细的传输信息。-C
:启用压缩。scp username@remote_host:/path/to/remote_file /path/to/local_directory/
scp username@remote_host:/path/to/remote_file /path/to/local_directory/local_file
scp /path/to/local_file username@remote_host:/path/to/remote_directory/
scp -r /path/to/local_directory username@remote_host:/path/to/remote_directory/
scp -P 22 -l 1000 -p -v -C username@remote_host:/path/to/remote_file /path/to/local_directory/
以上就是使用 scp 命令将远程文件复制到本地系统的介绍。scp 命令是一个强大且常用的工具,它可以方便地在本地系统和远程系统之间进行文件传输。