1、SFTP會話常見命令
SFTP會話中,輸入命令“help”可以顯示支持的命令。
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'
detail remote-path Display system information about remote
file or folder
ldetail local-path Display system information about local
file or folder
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'
exit Quit sftp
help Display this help text
include filename Include commands from 'filename'
Alternate: < filename
get [-r][-a | -b] remote-path Download file
-r downloads directory recursively
force ascii (-a) or binary (-b) mode
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
open [user@]host[:port] Connect to remote host
put [-r][-a | -b] local-path Upload file
-r uploads directory recursively
force ascii (-a) or binary (-b) mode
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
rmdir path Remove remote directory
lrmdir path Remove local directory
rm path Delete remote file
lrm path Delete local file
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
2、使用SFTP會話傳輸文件時常用命令:
pwd/lpwd 打印當前工作目錄
ls/lls 顯示目錄內容
cd/lcd 切換目錄
pwd、ls、cd操作遠程電腦文件,前面帶上l的命令(lpwd,lls,lcd)操作本地電腦文件。
get 下載遠程文件到本地電腦;
獲取遠程電腦new文件下的new.txt文件可使用命令 get new/new.txt;下載目錄在本地電腦的位置使用lpwd查看,可使用lcd切換下載目錄
put 上傳本地文件到遠程電腦;
上傳本地電腦local文件下的tmp.txt文件可使用命令 put local/tmp.txt;上傳目錄在遠程電腦的位置使用pwd查看,可使用cd切換下載目錄
注意:
1、上傳或下載文件夾和文件夾下內容需要使用 get -r / put -r
2、文件夾number下有2個文件number_1和number_2
get number 會下載文件number及文件number_1和number_2
get number/ 只下載文件number_1和number_2