使用 Xshell 的服务器上传下载文件 |
您所在的位置:网站首页 › escape工具栏 › 使用 Xshell 的服务器上传下载文件 |
使用Xshell自带的工具,不借助额外的工具,进行文件上传。 一、说明点击工具栏的新建文件传输(Ctrl+Alt+F),或者快捷键Ctrl+Alt+F如下所示。 点击之后,就会弹出一下的窗口,这里我们选择取消。 Xftp是一个文件上传的界面插件。需要单独下载,这里我们就不选用它。点击“取消”后,会自动进入到一个上传的命令行界面。 Xshell 5 (Build 0964) Copyright (c) 2002-2016 NetSarang Computer, Inc. All rights reserved. Type `help' to learn how to use Xshell prompt. [c:\~]$ Connecting to 47.32.152.32:22... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Your current local directory is C:\Users\houxin\Documents\NetSarang\Xshell\Sessions Type `help' to browse available commnands. sftp:/root>上面有显示当前的默认的本地目录是:C:\Users\houxin\Documents\NetSarang\Xshell\Sessions。这个后面有用。 二、上传文件上传文件使用put命令。 当前目录是root的家目录,可以使用cd等一系列命令继续切换到你的目标路径。这个我们切换到当前目录下的images目录。 sftp:/root> pwd Remote directory is /root sftp:/root> cd images sftp:/root/images> ls -a drwxr-xr-x 2 root root 6 Sep 21 16:00 . dr-xr-x--- 12 root root 4096 Sep 21 15:21 ..输入put后回车,会弹出一个windows的文件选择框。选择你需要的文件。然后点击确定就行了。 结果如下: sftp:/root/images> put Uploading 6a7ff800af8ca8aad0c901597a0ff63a.jpeg to remote:/root/images/6a7ff800af8ca8aad0c901597a0ff63a.jpeg sftp: sent 50.3 KB in 0.03 seconds这里显示已经将当前的文件上传到/root/images/里面了。 sftp:/root/images> ls -a drwxr-xr-x 2 root root 51 Sep 21 16:02 . dr-xr-x--- 12 root root 4096 Sep 21 15:21 .. -rw-r--r-- 1 root root 51580 Sep 21 16:02 6a7ff800af8ca8aad0c901597a0ff63a.jpeg文件已经上传成功了。 三、下载文件1、修改下载目录 还记得开篇的C:\Users\houxin\Documents\NetSarang\Xshell\Sessions地址吗?这个就是下载的默认目录。 如果你需要修改的话,可以使用lcd命令。 在命令行输入lcd后,选择一个文件夹,就是默认的下载地址。 这里我把下载地址换成windows的下载地址。 sftp:/root/images> lcd Local directory is now C:\Users\houxin\Downloads2、下载文件 下载文件,使用get [文件路径]命令。 当前路径下有abc.txt的文件,我下载它。 sftp:/root/images> ls -a drwxr-xr-x 2 root root 66 Sep 21 16:25 . dr-xr-x--- 12 root root 4096 Sep 21 15:21 .. -rw-r--r-- 1 root root 7 Sep 21 16:25 abc.txt sftp:/root/images> get abc.txt Fetching /root/images/abc.txt to abc.txt sftp: received 7 bytes in 0.01 seconds这里显示下载完成了。 我们在C:\Users\houxin\Downloads目录下,也看到了刚刚我们下载的文件。 这个是下载当前目录下的文件。如果想下载其他目录的文件,只需要加上绝对或者相对路径即可。 这里我们下载,当前目录中的aaa目录下的aaa.txt,命令如下: sftp:/root/images> get ./aaa/aaa.txt Fetching /root/images/./aaa/aaa.txt to aaa.txt sftp: received 0 bytes in 0.02 seconds可以灵活使用。 作者:houxin 链接: 来源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |