使用SecureCRT的SFTP傳輸文件
使用 FileZilla 上傳項目更新,因為軟件緩存沒處理好,三個文件花了三個小時~~
找一種緩存干擾最小的方式上傳文件。
1、在使用 SecureCRT 連接到 Linux 主機后,郵件連接的選項卡,選擇 連接SFTP標簽頁,進入sftp連接操作界面。


2、文件互傳:
常用命令:
| 命令 | 解釋 |
|---|---|
| ls [選項] [路徑] | 遠程 Linux 主機當前路徑下的文件 |
| lls [選項] [路徑] | 本地 Windows 主機當前路徑下的文件 |
| cd 路徑 | 更改遠程 Linux 主機目錄到“路徑” |
| lcd 路徑 | 更改本地 Windows主機目錄到“路徑” |
| put 本地路徑 | Windows主機 ---> Linux 主機 |
| get 遠程路徑 | Linux 主機 <--- Windows主機 |
實例:

代碼如下:
sftp> ls # 查看當前路徑下的文件
sftp> cd /. # 設置遠程 Linux 主機目錄到根目錄
sftp> cd /home/anzerong/Desktop/ # 設置遠程 Linux 主機目錄到到指定目錄
sftp> ls # 查看該目錄下文件
恢復1.sql
sftp> lls # 查看本地 Windows 主機當前路徑下的文件
sftp> lcd /. # 設置本地 Windows 主機目錄到根目錄
sftp> lcd /Users/anzerong/Desktop/ # 設置本地 Windows 主機目錄到到指定目錄
sftp> lls # 查看本地 Windows 主機當前路徑下的文件
sftp上傳測試.txt
sftp> put sftp上傳測試.txt # 以本地 Windows主機 ---> 遠程 Linux 主機方向傳輸文件
Uploading sftp上傳測試.txt to /home/anzerong/Desktop/sftp上傳測試.txt
100% 0 bytes 0 bytes/s 00:00:00
sftp> get 恢復1.sql # 以遠程 Linux 主機 <--- 本地 Windows主機方向傳輸文件
Downloading 恢復1.sql from /home/anzerong/Desktop/恢復1.sql
100% 1KB 1KB/s 00:00:00
/home/anzerong/Desktop/恢復1.sql: 1352 bytes transferred in 0 seconds (1352 bytes/s)
附:sftp標簽頁中所有命令
sftp> help
Available commands:
ascii Set transfer mode to ASCII
binary Set transfer mode to binary
cd path Change remote 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
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'
exit Quit sftp
help Display this help text
include filename Include commands from 'filename'
Alternate: < filename
get [-a | -b] remote-path Download file
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
open [user@]host[:port] Connect to remote host
put [-a | -b] local-path Upload file
force ascii (-a) or binary (-b) mode
pwd Display remote working directory
lpwd Print local working directory
quit Quit sftp
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
翻譯一下就是:
(來源:作者:xwdreamer 出處:http://www.cnblogs.com/xwdreamer)
sftp-- help
可用命令:
cd 路徑 更改遠程目錄到“路徑”
lcd 路徑 更改本地目錄到“路徑”
chgrp group path 將文件“path”的組更改為“group”
chmod mode path 將文件“path”的權限更改為“mode”
chown owner path 將文件“path”的屬主更改為“owner”
exit 退出 sftp
help 顯示這個幫助文本
get 遠程路徑 下載文件
ln existingpath linkpath 符號鏈接遠程文件
ls [選項] [路徑] 顯示遠程目錄列表
lls [選項] [路徑] 顯示本地目錄列表
mkdir 路徑 創建遠程目錄
lmkdir 路徑 創建本地目錄
mv oldpath newpath 移動遠程文件
open [用戶@]主機[:端口] 連接到遠程主機
put 本地路徑 上傳文件
pwd 顯示遠程工作目錄
lpwd 打印本地工作目錄
quit 退出 sftp
rmdir 路徑 移除遠程目錄
lrmdir 路徑 移除本地目錄
rm 路徑 刪除遠程文件
lrm 路徑 刪除本地文件
symlink existingpath linkpath 符號鏈接遠程文件
version 顯示協議版本
