Linux SFTP上传大文件:轻松突破4GB瓶颈

右键切换到sftp终端界面,查看help

There was a problem using the initial local directory C:\Users\00000\Documents: The system cannot find the path specified. 
Attempting to fall back to default initial path.
sftp> help
Available commands:
ascii Set transfer mode to ASCII
binary Set transfer mode to binary
cd path Change remote directory to 'path'
lcd path Change local directory to 'path'
chgrp group path Change group of file 'path' to 'group'
chmod mode path Change permissions of file 'path' to 'mode'
chown owner path Change owner of file 'path' to 'owner'
detail remote-path Display system information about remote
file or folder
ldetail local-path Display system information about local
file or folder
exit Quit sftp
get [-r] [-a | -b] [--nopreserve] [--move] [--no-flock] remote-path
Download file
-r downloads directory recursively
force ascii (-a) or binary (-b) mode
--nopreserve the timestamp and permissions
will not be preserved
--move the files will be moved
--no-flock disables the use of flock
help Display this help text
include filename Include commands from 'filename'
Alternate: < filename
ln [-s] existingpath linkpath Hardlink / symlink remote file
ls [options] [path] Display remote directory listing
lls [options] [path] Display local directory listing
mkdir path Create remote directory
lmkdir path Create local directory
mv oldpath newpath Move remote file
lmv oldpath newpath Move local file
put [-r][-a | -b] [--nopreserve] [--move] [--no-flock] local-path
Upload file
-r uploads directory recursively
force ascii (-a) or binary (-b) mode
--nopreserve the timestamp and permissions
will not be preserved
--move the files will be moved
--no-flock disables the use of flock
pwd Display remote working directory
lpwd Print local working directory
quit Quit sftp
rename oldname newname Rename remote file
lrename oldname newname Rename local file
rm path Delete remote file
lrm path Delete local file
rmdir path Remove remote directory
lrmdir path Remove local directory
su username Substitutes the current user
This is only supported with VShell for
Windows 3.5 or later.
type [transfer-mode] Display or set file transfer mode
view remote-path Download and open file
version Display protocol version

查看当前远程路径

sftp> pwd
/root

sftp> ls
anaconda-ks.cfg topo_news.yaml

sftp> cd /acdata/backup

sftp> ls
backup_bj_sjzt_db_cash_gjjx_sstj_06_tabs_2025-07-17_bk
backup_bj_sjzt_db_cash_gjjx_sstj_06_tabs_2025-07-17_bk.tar.gz

切换到本地要上传大文件的路径

sftp> lcd d:\

sftp> lls
$RECYCLE.BIN 10.3.9.9_backup_data
logs Program Files
Program Files (x86) ProgramData Python
System Volume Information User

sftp> lcd 10.3.9.9_backup_data
sftp> lpwd
d:\10.3.9.9_backup_data

准备上传大文件到远程

sftp> put d:\10.3.9.9_backup_data\backup_bj_sjzt_db_zhcx_03_tabs_2025-07-17_bk.tar.gz  /acdata/backup/
Uploading backup_bj_sjzt_db_zhcx_03_tabs_2025-07-17_bk.tar.gz to /acdata/backup/backup_bj_sjzt_db_zhcx_03_tabs_2025-07-17_bk.tar.gz
Skipping directory d:\10.3.9.9_backup_data
100% 4736564KB 14755KB/s 00:05:21
d:\10.3.9.9_backup_data\backup_bj_sjzt_db_zhcx_03_tabs_2025-07-17_bk.tar.gz: 4850241647 bytes transferred in 321 seconds (14755 KB/s)
sftp>

经过以上简单的几个命令操作,就可以实现从本地上传超过4g的大文件到远程服务器。