首页 技术 正文
技术 2022年11月23日
0 收藏 676 点赞 2,240 浏览 8388 个字

2、常用的为上传下载

1)、get

从远程服务器上下载一个文件存放到本地,如下:

先通过lcd切换到本地那个目录下,然后通过get file

>> lcd d:\            #表示切换到本地的d盘下

>> get ./test.sql   #这样就将当前文件下载本地的d盘下

2)、put

是将本地的文件上传到远程服务器上,如下:

>> put               #在windows下弹出选择文件的窗口

3)、lcd

先通过lcd切换到本地那个目录下

>> lcd c:\            #表示切换到本地的c盘下

4)、lls

#显示当前目录下的所有文件

5)、pwd

#显示当前目录

 

三、各个用法实例详解

实例1、从服务器下载文件到本机

Xshell 5 (Build 0806)

Copyright (c) 2002-2015NetSarang Computer, Inc. All rights reserved.

Type `help’ to learn howto use Xshell prompt.

[c:\~]$

Connecting to192.168.56.101:22…

Connection established.

To escape to local shell,press ‘Ctrl+Alt+]’.

Your current localdirectory is

C:\Users\FieldYang\Documents\NetSarang\Xshell\Sessions

Type `help’ to browseavailable commnands.

sftp:/root> cd /mnt/share 

#远程路径切换为/mnt/share

sftp:/mnt/share> ls –lt  

drwxrwxrwx   1 1000    users       4096 Jun 16 13:39 .

drwxr-xr-x   7 root    root        4096 Jun 15 14:06 ..

-rwxrwxrwx   1 1000    users     220151 Jun 15 14:26.goutputstream-ZHJ8IY

-rwxrwxrwx   1 1000    users      19362 Jun 16 12:270.jpg

-rwxrwxrwx   1 1000    users      16157 Jun 16 13:39Auth Server and SOAP proxy.docx

-rwxrwxrwx   1 1000    users      63952 Jun 16 12:29bamquickinstall.pdf

-rwxrwxrwx   1 1000    users       7277 Jun 16 13:33DNSmmmS.txt

-rwxrwxrwx   1 1000    users       7277 May 12 10:43DNSS.txt

-rwxrwxrwx   1 1000    users     111395 Jun 15 15:46libpcap-0.9.4-15.el5.x86_64.rpm

-rwxrwxrwx   1 1000    users     363677 Jun 15 14:59ppp-2.4.4-14.1.rhel5.x86_64.rpm

-rwxrwxrwx   1 1000    users      48430 Jun 15 14:57ppp-devel-2.4.4-14.1.rhel5.x86_64.rpm

-rwxrwxrwx   1 1000    users      86211 Jun 15 15:38pptpd-1.4.0-1.rhel4.x86_64.rpm

-rwxrwxrwx   1 1000    users      86509 Jun 15 14:46pptpd-1.4.0-1.rhel5.x86_64.rpm

-rwxrwxrwx   1 1000    users     220151 Jun 15 13:22Screenshot.png

-rwxrwxrwx   1 1000    users      21789 Jun 16 13:39Traffic Usage System alarm handling – Gateway, RadiusGWProxy, RadiusProxyServer.docx

sftp:/mnt/share> lcd d:\Field\test_sftp 

#切换到本地的d盘下Field文件夹的test_sftp文件夹

Local directory is nowd:\Field\test_sftp

sftp:/mnt/share> lpwd

Local directory isd:\Field\test_sftp

#打印本地文件夹路径

sftp:/mnt/share> lls

06/16/2016 05:44¤W   <DIR>             .

06/16/2016 05:44¤W   <DIR>             ..

#查看本地文件夹d:\Field\test_sftp内容

sftp:/mnt/share>get ./0.jpg ./DNSmmmS.txt./pptpd-1.4.0-1.rhel5.x86_64.rpm

#下载远程服务器/mnt/share上的0.jpg、DNSmmmS.txt、#pptpd-1.4.0-1.rhel5.x86_64.rpm到本地文件夹d:\Field\test_sftp中

Fetching/mnt/share/./pptpd-1.4.0-1.rhel5.x86_64.rpm to pptpd-1.4.0-1.rhel5.x86_64.rpm

sftp: received 84.4 KB in0.64 seconds

Fetching/mnt/share/./DNSmmmS.txt to DNSmmmS.txt

sftp: received 7.10 KB in0.02 seconds

Fetching/mnt/share/./0.jpg to 0.jpg

sftp: received 18.9 KB in0.03 seconds 

sftp:/mnt/share> lls –lt

#命令行查看是否下载成功

06/16/2016 05:47¤W   <DIR>             .

06/16/2016 05:47¤W   <DIR>             ..

06/16/2016 05:47¤W               19362 0.jpg

06/16/2016 05:47¤W                7277 DNSmmmS.txt

06/16/2016 05:47¤W               86509 pptpd-1.4.0-1.rhel5.x86_64.rpm

windows、linux互传文件

实例2、上传本地文件到远程服务器

sftp:/mnt/share> lcd d:\Field\SNINF\

#切换本地路径到d:\Field\SNINF\

Local directory is nowd:\Field\SNINF\

sftp:/mnt/share> lpwd

#打印本地当前路径

Local directory isd:\Field\SNINF\

sftp:/mnt/share> lls -lt

02/19/2016 07:50¤W   <DIR>             .

02/19/2016 07:50¤W   <DIR>             ..

12/11/2015 08:27¤W               16157 Auth Server and SOAP proxy.docx

12/11/2015 08:27¤W              464191 Check Plan–Jacky.docx

12/11/2015 08:27¤W              562801 CIMDB ¡V David.docx

12/11/2015 08:27¤W               12031 Disk Full ¡V For All Systems.docx

12/11/2015 08:27¤W              126440 EMMSC–Fox.docx

12/11/2015 08:27¤W              115928 ENUM ¡VJacky.docx

12/11/2015 08:27¤W              327650 F-Secure.docx

12/11/2015 08:27¤W              107606 GDS–Fox.docx

12/11/2015 08:27¤W              117762 GIMEI¡XFox.docx

12/11/2015 08:27¤W              310862 GUP CGUP ¡ΠRay.docx

12/11/2015 08:27¤W              650939 IP call –Sharon.docx

12/11/2015 08:27¤W              779957 Mex health check–Niker.docx

12/11/2015 08:27¤W              124195 NetScout (DPI)¡XFox.docx

12/11/2015 08:27¤W              198426 POC–Jacky.docx

12/11/2015 08:27¤W              326368 Radius Proxy -Niker.docx

12/11/2015 08:27¤W              190044 SMTP health check–Niker.docx

12/11/2015 08:27¤W               45643 Stretti DFS¡XSharon.docx

12/11/2015 08:27¤W              233654 Stretti DISC ¡VJacky.docx

12/11/2015 08:27¤W              449498 Traffic Router Health Check¡XDavid.docx

12/11/2015 08:27¤W               21789 Traffic Usage System alarm handling -Gateway, RadiusGWProxy, RadiusProxy Server.docx

12/11/2015 08:27¤W              734859 Video Transcoder¡XDavid.docx

12/11/2015 08:27¤W               14815 Virtual Browser.docx

12/11/2015 08:27¤W               22554 ZMMSC.docx

12/11/2015 08:27¤W              219776 ZProxy ¡ΠFox.docx

12/11/2015 08:27¤W              221199 ZWAPGW NZWAPGW ¡ΠFox.docx

sftp:/mnt/share> put

Uploading Traffic UsageSystem alarm handling – Gateway, RadiusGWProxy, RadiusProxy Server.docx toremote:/mnt/share/Traffic Usage System alarm handling – Gateway, RadiusGWProxy,RadiusProxy Server.docx

sftp: sent 21.2 KB in 0.01seconds

#在弹出的Windows框中选择文件上传 注意上传路径与当前路径要相同 

sftp:/mnt/share> put

Uploading VirtualBrowser.docx to remote:/mnt/share/Virtual Browser.docx

sftp: sent 14.4 KB in 0.02seconds

sftp:/mnt/share> put

Uploading CheckPlan–Jacky.docx to remote:/mnt/share/Check Plan–Jacky.docx

sftp: sent 453 KB in 0.05seconds

sftp:/mnt/share> put

Uploading ZMMSC.docx toremote:/mnt/share/ZMMSC.docx

sftp: sent 22.0 KB in 0.00seconds

sftp:/mnt/share> ls -lt

drwxrwxrwx   1 1000    users       4096 Jun 16 13:54 .

drwxr-xr-x   7 root    root        4096 Jun 15 14:06 ..

-rwxrwxrwx   1 1000    users     220151 Jun 15 14:26.goutputstream-ZHJ8IY

-rwxrwxrwx   1 1000    users      19362 Jun 16 12:270.jpg

-rwxrwxrwx   1 1000    users      16157 Jun 16 13:39Auth Server and SOAP proxy.docx

-rwxrwxrwx   1 1000    users      63952 Jun 16 12:29bamquickinstall.pdf

-rwxrwxrwx   1 1000    users     464191 Jun 16 13:53Check Plan–Jacky.docx

-rwxrwxrwx   1 1000    users       7277 Jun 16 13:33DNSmmmS.txt

-rwxrwxrwx   1 1000    users       7277 May 12 10:43DNSS.txt

-rwxrwxrwx   1 1000    users     111395 Jun 15 15:46libpcap-0.9.4-15.el5.x86_64.rpm

-rwxrwxrwx   1 1000    users     363677 Jun 15 14:59ppp-2.4.4-14.1.rhel5.x86_64.rpm

-rwxrwxrwx   1 1000    users      48430 Jun 15 14:57 ppp-devel-2.4.4-14.1.rhel5.x86_64.rpm

-rwxrwxrwx   1 1000    users      86211 Jun 15 15:38pptpd-1.4.0-1.rhel4.x86_64.rpm

-rwxrwxrwx   1 1000    users      86509 Jun 15 14:46pptpd-1.4.0-1.rhel5.x86_64.rpm

-rwxrwxrwx   1 1000    users     220151 Jun 15 13:22Screenshot.png

-rwxrwxrwx   1 1000    users      21789 Jun 16 13:52Traffic Usage System alarm handling – Gateway, RadiusGWProxy, RadiusProxyServer.docx

-rwxrwxrwx   1 1000    users      14815 Jun 16 13:53Virtual Browser.docx

-rwxrwxrwx   11000    users      22554 Jun 16 13:54 ZMMSC.docx

sftp:/mnt/share>

实例3、在远程服务器创建删除目录

sftp:/mnt/share> mkdir /mnt/share/test

#在远程服务器上创建目录/mnt/share/test

sftp:/mnt/share> cd /mnt/share/test

sftp:/mnt/share/test> pwd

#查看是否创建成功

Remotedirectory is /mnt/share/test

sftp:/mnt/share/test> cd /mnt/share/

sftp:/mnt/share> rmdir /test

cannotremove /test: no such a directory

sftp:/mnt/share>rmdir /mnt/share/test

#删除刚创建的目录/mnt/share/test

sftp:/mnt/share> cd /mnt/share/test

cannotchange to /mnt/share/test: no such a directory

#确认是否删除成功

实例4、在远程服务器删除文件

sftp:/mnt/share> rm ./ZMMSC

#删除远程服务器/mnt/share上的文件ZMMSC.docx,./表示当前目录

cannotdelete /mnt/share/./ZMMSC: no such a file

sftp:/mnt/share> rm ./ZMMSC.docx

deleted/mnt/share/./ZMMSC.docx

sftp:/mnt/share> rm ./Traffic UsageSystem alarm handling – Gateway, RadiusGWProxy, RadiusProxy Server.docx

usage:rm file

sftp:/mnt/share> rm ./DNSS.txt

deleted/mnt/share/./DNSS.txt

sftp:/mnt/share> ls

#查看是否成功删除

drwxrwxrwx   1 1000    users       4096 Jun 16 14:25 .

drwxr-xr-x   7 root    root        4096 Jun 15 14:06 ..

-rwxrwxrwx   1 1000    users     220151 Jun 15 14:26.goutputstream-ZHJ8IY

-rwxrwxrwx   1 1000    users      19362 Jun 16 12:270.jpg

-rwxrwxrwx   1 1000    users      16157 Jun 16 13:39 AuthServer and SOAP proxy.docx

-rwxrwxrwx   1 1000    users      63952 Jun 16 12:29bamquickinstall.pdf

-rwxrwxrwx   1 1000    users     464191 Jun 16 13:53Check Plan–Jacky.docx

-rwxrwxrwx   1 1000    users       7277 Jun 16 13:33DNSmmmS.txt

-rwxrwxrwx   1 1000    users     111395 Jun 15 15:46libpcap-0.9.4-15.el5.x86_64.rpm

-rwxrwxrwx   1 1000    users     363677 Jun 15 14:59ppp-2.4.4-14.1.rhel5.x86_64.rpm

-rwxrwxrwx   1 1000    users      48430 Jun 15 14:57ppp-devel-2.4.4-14.1.rhel5.x86_64.rpm

-rwxrwxrwx   1 1000    users      86211 Jun 15 15:38pptpd-1.4.0-1.rhel4.x86_64.rpm

-rwxrwxrwx   1 1000    users      86509 Jun 15 14:46pptpd-1.4.0-1.rhel5.x86_64.rpm

-rwxrwxrwx   1 1000    users     220151 Jun 15 13:22Screenshot.png

-rwxrwxrwx   1 1000    users      21789 Jun 16 13:52Traffic Usage System alarm handling – Gateway, RadiusGWProxy, RadiusProxyServer.docx

-rwxrwxrwx   1 1000    users      14815 Jun 16 13:53Virtual Browser.docx

sftp:/mnt/share>

微信扫一扫

支付宝扫一扫

本文网址:https://www.zhankr.net/141869.html

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:875 阅读:5,090
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:806 阅读:3,508
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:565 阅读:4,320
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:730 阅读:4,314
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:4,920
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:3,105
发表评论
暂无评论

还没有评论呢,快来抢沙发~

助力内容变现

将您的收入提升到一个新的水平

点击联系客服

在线时间:8:00-16:00

客服电话

400-888-8888

客服邮箱

ceotheme@ceo.com

扫描二维码

关注微信公众号

扫描二维码

手机访问本站