两台主机传输数据文件命令操作(scp/rsync/sftp/http)

scp:

# 从主机A拷贝文件到主机B
scp /path/to/file user@remote_host:/path/to/destination

# 从主机B拷贝文件到主机A
scp user@remote_host:/path/to/file /path/to/local

rsync:

# 拷贝文件或目录
rsync -avz /local/path user@remote_host:/remote/path

sftp:

sftp user@remote_host
sftp> put file.txt        # 上传文件
sftp> get file.txt        # 下载文件

http:

# 主机A
# 在主机A上运行(默认8000端口)
cd /path/to/files
python3 -m http.server 8000
posted on 2025-08-29 14:07  CharXL  阅读(15)  评论(0)    收藏  举报