本地windows机器和远程Linux服务器之间文件传输 -- Xshell 使用sftp 上传下载文件

一、登录远程Linux服务器:

[c:\~]$ sftp root@192.168.233.136

1.1、回车进行认证:
回车输入密码
1.2、登录成功:
登录成功

二、上传文件到服务器:
2.1上传操作
拖拽待上传文件到当前窗口即可
上传过程
上传结果
另一种方式–使用命令:

sftp:/root> lcd E:\安装包\linux下\
Local directory is now E:\安装包\linux下\

sftp:/root> put jdk-7u80-linux-x64.tar.gz
Uploading jdk-7u80-linux-x64.tar.gz to remote:/root/jdk-7u80-linux-x64.tar.gz
sftp: sent 146 MB in 2.72 seconds

上传结果

*注意:
界面可能会乱码,调一下界面显示语言的编码即可
因为我的windows是windows10中文版,默认编码是gbk,我把编码改成gbk就可以了
设置编码是这个按钮:*
设置编码按钮
三、从服务器下载文件到本地机器
切换到保存服务器下载文件的目录下再进行下载文件操作

sftp:/root> lcd D:\Temp
Local directory is now D:\Temp
sftp:/root> lpwd
Local directory is D:\Temp
sftp:/root> get apache-tomcat-8.0.47.tar.gz
Fetching /root/apache-tomcat-8.0.47.tar.gz to apache-tomcat-8.0.47.tar.gz
sftp: received 8.93 MB in 0.34 seconds

下载结果

附:
参考命令:
1、

[c:\~]$ sftp
NAME
    sftp - connects to a host to transfer files securely.

SYNOPSYS
    sftp [user@]host [port]

OPTIONS
    user   Indicates the user's login name.
    host   Indicates the name, alias, or Internet address of the
           remote host.
    port   Indicates a port number (address of an application).
           If the port is not specified, the default ssh port
           (22) is used.

sftp帮助文档
2、

sftp:/root> help
bye     finish your SFTP session
cd      change your remote working directory
clear   clear screen
exit    finish your SFTP session
explore explore your local directory
get     download a file from the server to your local machine
help    give help
lcd     change and/or print local working directory
lls     list contents of a local directory
lpwd    print your local working directory
ls      list contents of a remote directory
mkdir   create a directory on the remote server
mv      move or rename a file on the remote server
put     upload a file from your local machine to the server
pwd     print your remote working directory
quit    finish your SFTP session
rename  move or rename a file on the remote server
rm      delete a file
rmdir   remove a directory on the remote server

进入sftp交互界面帮助文档

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值