使用Linux SFTP上传大文件,可以遵循以下步骤:
sftp
命令连接到你的远程SFTP服务器。sftp username@hostname
username
为你的用户名,hostname
为服务器的地址。cd
命令切换到你想要上传文件的目录。cd /path/to/destination
put
命令上传文件。如果文件较大,可以考虑分块上传或使用scp
命令(基于SSH)。put /path/to/local/largefile.zip
exit
退出SFTP会话。scp
命令(更高效)scp
命令基于SSH,通常比SFTP更快,特别是对于大文件。
打开终端。
使用scp
上传文件:
scp /path/to/local/largefile.zip username@hostname:/path/to/destination
scp
会显示传输进度,并在完成后通知你。split
命令将文件分割成多个小块,然后分别上传,最后在服务器端使用cat
命令合并。split -b 1G largefile.zip largefile_part_
scp largefile_part_* username@hostname:/path/to/destination
ssh username@hostname "cat largefile_part_* > largefile.zip"
rm largefile_part_*
rsync
:如果你需要频繁地同步文件,rsync
是一个更好的选择,它支持增量传输和断点续传。rsync -avz --progress /path/to/local/largefile.zip username@hostname:/path/to/destination
通过以上方法,你应该能够顺利地在Linux系统上使用SFTP上传大文件。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:如何用Linux SFTP传输大文件