使用SecureCRT的SFTP传输文件

使用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                        显示协议版本 
posted @ 2017-11-01 10:05  奋斗小菜鸟  阅读(10521)  评论(3编辑  收藏  举报