[linux]两台Linux服务器之间传输文件的四种方法
warning:
这篇文章距离上次修改已过446天,其中的内容可能已经有所变动。
在Linux服务器之间传输文件,可以使用以下四种方法:
- 使用
scp(Secure Copy):
scp /path/to/local/file username@remote_server:/path/to/remote/directory- 使用
rsync(Remote Sync):
rsync -avz /path/to/local/file username@remote_server:/path/to/remote/directory- 使用
sftp(SSH File Transfer Protocol):
sftp username@remote_server
put /path/to/local/file /path/to/remote/directory- 使用
ssh(Secure Shell) 结合tar进行压缩传输:
tar -czvf - /path/to/local/file | ssh username@remote_server 'cd /path/to/remote/directory && tar -xzvf -'每种方法都需要服务器之间网络连接,并且需要知道远程服务器的用户名和IP地址或主机名。这些命令应在本地服务器上运行。记得替换路径和文件名以适应你的具体情况。
评论已关闭