Putty Tool Tutorial

The most important reason why putty is used
        is that it is free, and the paid ssh client is not allowed in the company. So I started using some free ssh client tools. I found that Putty is not bad to use, small and compact, easy to use, basically can meet the needs of the work, the main functions: ssh client, pscp, psftp, etc.

Download and install
        Download address: PuTTY: a free SSH and Telnet client

There is nothing special to install, just follow the prompts. After the installation is complete, you can find putty in the program of the start menu.

 

        It is recommended to read the help document first, which contains some introductions (I use putty for most of the operations through this document and a small amount of Baidu). Although the document is in English, it can still be understood (my English is very good), in fact, learn Looking at such official documents is a self-learning ability.

      pageant : Authentication Proxy Management Tool

       psftp: command-line file transfer tool similar to ftp

       putty: putty main program

       puttygen: key generator       

use putty

ssh login

 


Open putty, it will enter the Session interface by default, enter the host name or ip and port on this interface and click Open to start the session connection. Connection types include: SSH (the default connection protocol is recommended to use this protocol), serial, Telnet, Rlogin, SUPDUP, etc.

If it is the first connection, a pop-up box will pop up for ssh-key to receive a security reminder. Select Accept, and the prompt will not be displayed the next time you connect.

 

 

        Entering this interface means that the connection is successful, and it is required to enter the login name, and then press the [Enter] key. If the host name and ip are wrong or the server cannot be connected, a pop-up prompt box of connection timeout will appear.

                                

 

 Enter the password, note that the password input will not be displayed on the interface. If the password is wrong, you will be prompted to enter the password again.

After a successful login, there will be a description prompt of the last login.

 

 Well, you can start your own linux exploration journey.

 

Let’s talk about putty’s default shortcut paste and copy function: the mouse selects the default copy, and right-clicks the default paste at the cursor.

This default function is very user-friendly, at least much more convenient than the shortcut keys of the window command line window and xshell, which is one of the reasons why I prefer to use putty now.

To exit the session connection, you can use the exit command or close the window directly.

save session


        At the beginning, I was not used to using putty without saving the session information. I had to enter the ip every time I connected. In fact, putty has the function of saving the session.

 

        Enter the session name in the Saved Sessions box, and then click [save] to save the connection information to the session list. When you open putty next time, select the session information and click [load] to complete the connection information.

adjust font
        

 

If you adjust the font, just take a screenshot and don’t say anything. As a reminder, this font setting is associated with the session information. It is recommended to set the font first, and then save the session information. When you use it next time, you will directly load the corresponding session information and the font will change accordingly. (When I connected to a new service, I found that the font size of the window changed to 10. The font size of the window opened in the previous session of setting the font is the corresponding setting size. In fact, changing the font setting of putty to general will be more in line with user habits)

Regarding the other functions on the putty menu, I have never used them, and I will add a summary after they are useful.

pscp command to transfer files


        When using the ssh client, file transfer operations are indispensable. The pscp command is one of the file transfer operations supported by putty.

 

        I found this command in the help manual, so I tried it.

The pscp command can be executed directly in the dos window of the window or the git command window (git bash here) (I prefer to use the git command window).

Download the file locally

pscp [可选参数] [远程服务用户@]远程服务地址:要下载的文件路径  保存到本地路径
 
eg: pscp [email protected]:/home/pscp.txt D:/data/
 


After entering the correct command, you will be prompted to enter the remote server login password, and the download will start if the password is correct.

 

 Upload files to remote services

pscp [可选参数] 上传的文件路径(可多个,可相对路径)  [远程服务用户@]远程服务地址:要保存的地址路径
 
eg:  pscp yzt2.properties cde.properties [email protected]:/home/

 

Other optional parameters will be added when they are useful

Disadvantages of pscp: 1. "One-shot deal" exits the session directly after executing the current command

                       2. When entering the password in the git command window, the input password is displayed (there is no such phenomenon in the dos window)

 Putty also has a better file transfer solution: the built-in psftp tool

psftp tool to transfer files


        This tool is used as a command window version of the FTP transfer tool. Of course, I also learned this tool from the help documentation.

 

 open connection service

open 远程服务地址 
 
eg: open 192.168.56.101


Open the putty tool window, enter the above open command and follow the prompts to enter the user and password to connect

 

Commonly used file operation commands for psftp
 

//cd 路径  用于切换工作目录
cd /home
 
//ls  用于查看工作目录下资源
ls
 
//mv 文件路径1 新文件路径2 用于移动文件或者文件改名
mv yzt5.properties  yzt5005.txt
 
//del 文件路径  用于删除文件
del yzt5005.txt
 
//mkdir 新目录名  用于创建目录
mkdir psftp
 
//rmdir 目录名  用于删除目录
rmdir psftp

get command to download files

// get 远程要下载的文件路径  [可选 本地绝对地址的路径,不写则会下载到putty安装目录下]
get yzt2.properties  d:\data\yzt2.txt

 

 The put command uploads files to remote services

//put 本地文件路径 [可选 远程路径地址,不写则直接上传到工作下]
put d:\data\yzt2.txt

 

mget, mput command multiple file transfer
 

//mput 文件路径1 文件路径n   用于多文件路径上传
mput d:\data\hjt.properties d:\data\readme.txt 
 
//mget 文件路径1 文件路径n 或者 正则匹配文件名 用于多文件的下载
mget *.txt  //下载工作目录下以.txt结尾的文件
//注意是mget 把文件下载到putty安装目录下,目前暂时没有找到能下载到指定路径的方法

————————————————
Copyright statement: This article is an original article of CSDN blogger "IT is not a code farmer", following the CC 4.0 BY-SA copyright agreement, please attach the original source link for reprinting and this statement.
Original link: https://blog.csdn.net/qq_15089775/article/details/122071847

Guess you like

Origin blog.csdn.net/LforikQ/article/details/130919238