putty怎么上传下载文件和目录

转载自https://blog.51cto.com/net881004/2149896

xshell最近开始套路(收费)了,SecureCRT只有破解版(涉及到版权)。在建议用户用什么linux远程工具的时候犯难,最后选择的是putty。不过putty有个弊端,就是用不了rz、sz命令上传下载文件,很不方便。

后来查阅网上资料,发现putty提供了相关工具上传和下载文件。
从下面这个网址下载putty,一般包含了我们这里讲的pscp、psftp(如果没包含,这个页面也可以单独下载。pscp上传下载文件,psftp上传下载目录)。
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html


切换到putty安装目录:

C:\Users\NUC>cd C:\Program Files\PuTTY

一、pscp上传下载文件
windows上传文件到linux下:

C:\Users\Administrator>pscp C:\Users\Administrator\Desktop\login_zh_CN.png [email protected]:/root
[email protected]'s password:
login_zh_CN.png           | 4 kB |   4.1 kB/s | ETA: 00:00:00 | 100%


从linux向windows传文件:

C:\Users\Administrator>pscp [email protected]:/root/login_zh_CN.png  D:/test/



二、psftp上传下载目录
windows上传文件到linux下:

C:\Program Files\PuTTY>psftp.exe
psftp: no hostname specified; use "open host.name" to connect
psftp> open 192.168.1.106
login as: root
[email protected]'s password:
Remote working directory is /root
psftp> cd gxm
Remote directory is now /root/gxm
psftp> lcd d:\
New local directory is d:\
psftp> put GJY.txt
local:GJY.txt => remote:/root/gxm/GJY.txt


从linux向windows传文件:

psftp> get "GJY.txt" "D:/test/GJY.txt"
remote:/root/gxm/GJY.txt => local:D:/test/GJY.txt

传目录的命令:put -r D:/test /root
下载目录的命令:get -r test d:/tools/test
备注:下载到指定目录,要指定重命名的文件或目录,如果不重命名就用原来的文件或目录名。

猜你喜欢

转载自blog.csdn.net/Anton8801/article/details/91343949