10 Awesome PuTTY Tips and Tricks You Probably Didn’t Know

by Ramesh Natarajan on July 27, 2009

Windows PuTTY TutorialPuTTY is hands-down the best SSH client for Windows. It’s light-weight with a single putty.exe file and nothing else to install.

A while back we wrote about 12 powerful PuTTY software add-ons and explained how PuTTY connection manager can help you to organize PuTTY SSH sessions in tabs.

In this article, let us review 10 awesome native PuTTY tips and tricks that you might have not explored earlier.

If you have not used PuTTY earlier and you have heard only about Silly Putty and Mighty Putty and not the PuTTY software, you may want to download PuTTY software from the official PuTTY download page here before exploring these PuTTY tricks.

PuTTY Trick 1: Delete All PuTTY Sessions Together

When you are swapping an old computer with a new computer, you may end-up transferring all PuTTY sessions to new computer. Once you’ve transferred all PuTTY sessions, execute “putty -cleanup” from the command line as shown below.

C:>putty -cleanup

This will display following warning message. Click on ‘Yes’ to wipe-out all PuTTY session and random seed files from the Windows registry. This is a better process to delete all saved PuTTY sessions from Windows registry instead of deleting one-by-one from the PuTTY session list.

Fig: PuTTY Cleanup Sessions

Fig: PuTTY Cleanup Sessions

PuTTY Trick 2: Change Font Size Automatically when Resizing PuTTY Window

By default when you resize a PuTTY window, the font size doesn’t change. Sometimes it would be good if font size decrease when you reduce the PuTTY window size (or) font size increase when you increase the PuTTY window size.

For example, when you are running Unix top command, if you try to resize the window, the output will get cut-off in the PuTTY as shown below.

Fig: Partial output truncated during PuTTY window resize

Fig: Partial output truncated during PuTTY window resize

Launch PuTTY -> Select a Session -> Click on Load. From left side tree menu click on Window -> select the “Change the size of the font” under “When window size is resized” section as shown below -> Click on ‘Open’ at the bottom of this window to start the session.

Fig: PuTTY Change the font size automatically

Fig: PuTTY Change the font size automatically

After the above change, start the PuTTY SSH session and login again. Start the Unix top command and try to resize the window. When you reduce the window size, the font size will become smaller and adjust the top command output automatically to fit in the small size screen as shown below.

Fig: Unix top command output not truncated

Fig: Unix top command output not truncated

Note: Instead of automatically adjusting the font size during window resize, you can also set the following options “When window is resized” from the PuTTY configuration window.

  • Change the number of rows and columns.
  • Change the size of the font. (this is the option we discussed in this tip)
  • Change font size only when maximized.
  • Forbid resizing completely. (This option can be very helpful, when you don’t want PuTTY window resizing to happen)

PuTTY Trick 3: Change the PuTTY SSH Session Window Title

By default, PuTTY software displays “username@hostname:~” in the PuTTY window title after you login. You can change this to any user-friendly text.

Launch PuTTY -> Select a Session -> Click on Load. From left side tree menu click on Window -> Behavior. On the right panel, in the ‘Window Title’ text box enter the desired windows title as shown below. After this change, make sure to save the session.

Fig: Custom Window Title for PuTTY SSH Session

Fig: Custom Window Title for PuTTY Session

Load this saved PuTTY SSH session and login again to the server, which will display the new updated window title as shown below.

Fig: PuTTY Session showing user defined custom window title

Fig: PuTTY Session showing user defined custom window title

PuTTY Trick 4: View PuTTY Event log

When you are logged-in to a PuTTY SSH session, right mouse-click on the PuTTY window title, which will display PuTTY menu. Select ‘Event Log’ menu-item, which will display the following PuTTY event log window.

This will be very helpful to debug any PuTTY SSH session issues.

Fig: PuTTY Event Log Display

Fig: PuTTY Event Log Display

PuTTY Trick 5: Paste to Clipboard in Rich Text Editor (RTF) Format

Typically when you copy/paste from PuTTY window to a word document, it will paste only in plain text as explained below.

  • Login to PuTTY Telnet or SSH session without setting the ‘Paste to clipboard in RTF’ option that was explained below.
  • Execute ‘man ssh’ from the command line.
  • Copy the first few lines of the man output.
  • Launch Microsoft Word and paste the output. You’ll see only the text output without any formatting.

Enable the RTF copy/paste feature in PuTTY software as shown below.

Launch PuTTY terminal -> Select a Session -> Click on Load. From left side tree menu click on Window -> Selection. On the right panel, select the check-box where it says “Paste to clipboard in RTF as well as plain text” as shown in the image below.

Fig: Enable Rich Text Paste to Clipboard in PuTTY

Fig: Enable Rich Text Paste to Clipboard in PuTTY

  • Login to PuTTY telnet or SSH session after setting the ‘Paste to clipboard in RTF’ option that was explained above.
  • Execute ‘man ssh’ from the command line.
  • Copy the first few lines of the man output.
  • Launch Microsoft Word and paste the output. You’ll see only the text output getting copied with all the format as shown below.
Fig: Rich Text copied from PuTTY to MS-Word with formatting

Fig: Rich Text copied from PuTTY to MS-Word with formatting

PuTTY Trick 6. Make PuTTY SSH Session Always Stay On Top

Sometimes when you are running a monitoring session (for example, unix top command), you may want the PuTTY client window to stay on top all the times.

Launch PuTTY terminal -> Select a Session -> Click on Load. From left side tree menu click on Window -> Behavior. On the right panel, click on the check-box where it says “Ensure window is always on top” as shown below.

Fig: PuTTY Window Behavior - Always on Top

Fig: PuTTY Window Behavior - Always on Top

After this change, login to the PuTTY FTP or SSH or telnet session. This particular session will always stay on top irrespective of any other application you open in the windows.

PuTTY Trick 7: Launch PuTTY Client In Full Screen Mode

Following are the two methods to launch PuTTY client in full screen mode.

Method 1: When the PuTTY client session is running, right mouse-click on the window title and select ‘Full Screen’ (or)

Method 2: Launch PuTTY -> Select a Session -> Click on Load. From left side tree menu click on Window -> Behavior. On the right panel, click on the check-box where it says “Full Screen on Alt Enter” as shown below.

Fig: Press Alt-Enter for PuTTY Full Screen

Fig: Press Alt-Enter for PuTTY Full Screen

After this change, when the PuTTY terminal session is running, press Alt Key + Enter Key to run that particular PuTTY session in full screen.

PuTTY Trick 8: Launch PuTTY Window Maximized by Default

By default when you launch any PuTTY terminal session, it runs in the normal window size. Sometimes you may prefer it to start in a maximized mode. Follow the steps mentioned below.

  • Create a new PuTTY windows shortcut.
  • Right mouse-click on this windows shortcut and select properties.
  • Click on the Run drop-down list and select ‘Maximized’ as shown below.
  • Now, anytime you use this PuTTY shortcut to launch any session, it will be displayed in maximized mode by default.
Fig: Open PuTTY in Maximum Window Size

Fig: Open PuTTY in Maximum Window Size

PuTTY Trick 9. Move Putty sessions to another computer

PuTTY stores all the session information in Windows registry. On the source machine, export the PuTTY session registry information as shown below.

C:> regedit /e "%userprofile%\desktop\putty-registry.reg" HKEY_CURRENT_USER\Software\Simontatham

Transfer this putty-registry.reg file from source machine to destination machine.

On the destination machine, import the PuTTY SSH session registry, by right mouse-click on the putty-registry.reg and click on ‘Merge’. This will transfer all the PuTTY session information from one windows system to another.

Fig: Transfer Windows PuTTY Registry to another computer

Fig: Transfer Windows PuTTY Registry to another computer

PuTTY Trick 10: Launch Most frequently Used PuTTY Session Quickly

To launch a most frequently used PuTTY session quickly, follow the steps below.

  • Create a new PuTTY windows shortcut
  • Rename this shortcut to your favorite name. For example, dev-db.
  • Right mouse-click on this shortcut and select properties.
  • In the Target field, at the end append “-load putty-session-name” as shown below.
  • Now, anytime you click on the dev-db windows shortcut, it will automatically launch the dev-db PuTTY session.
Fig: Launch PuTTY session with one click from command line

Fig: Launch PuTTY session with one click from command line


Linux Sysadmin Course Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.
Get the Linux Sysadmin Course Now!

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 46 comments… read them below or add one }

1 sasikala July 27, 2009 at 3:18 am

Thanks for the great tips.. Its more useful.

2 runlevel0 July 27, 2009 at 8:46 am

Another neat trick:
Setting the hostname as window title:

I need to open a lot of terminals to different servers and I need to be able to identify them…
PuTTY can indeed manage some variables set from within the $HOME/.bash_profile of the UNIX user.

And that’s how it looks like:

PROMPT_COMMAND=’echo -ne “33]0; $HOSTNAME 07″‘

You can also add some stuff of your own:

PROMPT_COMMAND=’echo -ne “33]0; $HOSTNAME [-ARCHIVE SRV 01-] 07″‘

Regards,
Enric

3 Tapas Mallick July 28, 2009 at 1:30 am

Trick 3: During login, Window Title is showing as defined but not after login (It is showing merely same as PS1). Any update or resolution ?

Regards,
Tapas Mallick

4 runlevel0 July 28, 2009 at 6:29 am

Hi Tapas,
You can use my approach, the variable PROMPT_COMMAND will be displayed in the window title, you can put there pretty much anything.

In my above example I use the hostname but you can use a fixed string or just anything that you would be able to use to set a prompt like in $PS1.

5 Kiran July 28, 2009 at 11:15 am

I have been using putty since 1 year but never had time to check its features and options. You tips are really helpful to everyone who uses Putty in his daily life.

Kiran

6 Ramesh Natarajan August 2, 2009 at 5:17 pm

@Sasikala, @Kiran,

Thanks for your comment. I’m very glad that you found this article helpful.

@runlevel0,

Thanks for sharing your neat trick on changing the window title using PROMPT_COMMAND.

For those who are interested, check-out our earlier post to learn more about PROMPT_COMMAND examples.

@Tapas,

The tip given by runlevel0 should solve the problem you’ve mentioned.

7 Huy April 15, 2010 at 11:03 pm

I like trick 5, trick 8, trick 10. Thank for sharing.

8 SSH Guy June 17, 2010 at 5:32 pm

I I need to run SSH tunnels, I launch the Putty session with my saved profile.
I can embed that in a script to launch Putty, create the SSH tunnels and then launch my applications.

I’d like to automatically kill the putty session as well when I terminate my applications. Any idea other than using something nasty like KillWin or PSKILL?

9 Anonymous July 5, 2010 at 3:46 pm

when I copy paste on putty
for example
access-list 101 extended permit tcp object-group CustomerAdmin any object-group AdminPorts

it show like following . Cant figure out. How do I fix it?
access-list 101 extended permit tcp object-group Custom$

10 fullscreen CL switch? September 8, 2010 at 8:32 am

Is there any way to make a session or putty shortcut open in fullscreen by default?

11 Indie February 25, 2011 at 9:39 am

If you’re using a UTF-8 lang on the server then PuTTy won’t display the extended characters correctly, i.e. if you run something like “system-config-network” on CentOS, the box doesn’t look right, also I think some man pages aren’t formatted correctly. If your $LANG variable is something like en_GB.UTF-8 then change
Window->Translation->character set to UTF-8
for it to display the text correctly.

12 Salih March 26, 2011 at 7:57 pm

Hi Ramesh,

Very Helpful article about PuTTy

I have a question. How can i set default domain name in PuTTy.

To be more clear about my question ,if my server name is salihdb01.salihdomain.com , i want to connect to the the server just by typing salihdb01

Please let me know.

Thanks in Advance,
Salih KM

13 BDH March 29, 2011 at 12:16 pm

Help!!
I have installed Putty Connection manger but when i open a single or multiple session i0/they topens in a seperate putty window. I have read the help files and have followed the recommendations but does not correct this problem anybody have any suggestions. Thanks for the help.

14 Indie March 30, 2011 at 2:29 pm

@Salih: That has nothing to do with PuTTY, it’s configured by the systems resolver library and is called the DNS suffix search list. Under you can configure it under the interface properties or as a local policy object. If you google for the above phrase you’ll get plenty of results.

15 BDH April 5, 2011 at 10:11 am

If after installing Putty Connection Manager, you have the problem where when you open a single or multiple sessions and they open under seperate windows outside of Putty Connection manager, do the following to correct the issue. Open Putty Connection Manager and click on “TOOLS” – “OPTIONS” then in the options window on the left side click on Plugins and then Putty. Then on the right side of the window put a Check in the box next to “Enable additional timing for PuTTY capture (ms); and set the timing to 800ms. This corrected the issue for me and I can now open a single session or multiple sessions inside the PuTTY Connection Manager window.

16 VIJAY April 7, 2011 at 10:50 am

Great tips .. thnx

17 Zakaria Shaikh May 26, 2011 at 11:22 am

I set the ‘Lines of scrollback’ to 2000000000.
That way I can save all the work done for future reference.

18 arielCo May 27, 2011 at 9:00 am

@Zakaria: Careful, 2 billion lines practically means “use as much memory as the o/s allows”. If PuTTY segfaults for lack of memory you’ll have zero to save.

19 Kenneth October 13, 2011 at 7:50 am

Trick 10 – did not work for me until I renamed my stored session. Had started the name with a capital letter

Kind regards

20 Ash October 30, 2011 at 6:15 am

hi, thanks for the great tips
i have a question if i have a html page with a drawing of routers and switches and i want to click on each and open a putty session of each (click and be in the ssh session of this router or switch) how is that possible

21 Alexander Ewering November 27, 2011 at 8:56 am

While Putty might be the best SSH client for Windows (I haven’t tried any others), its UI is a complete nightmare and notoriously “open-sourceish”, i.e., hard to use for anyone with a normal brain.

The session saving/loading facility is ridiculously hard to understand and use, the taskbar button and main window vanish/reappear without any sign of concept, and when you misspell the login name, bummer – you have to restart the whole enchilada.

22 Alix January 5, 2012 at 8:46 am

Hello, I’m using pettycm since one year, I get this message : RUNTIME ERROR : Unable to load external plugin library (C:\mfc71.dll)
Error : Could not load file or assembly ‘file:///C:\mfc71.dll’ or one of its dependencies
Error : Could not load file or assembly ‘file:///C:\msvcp71.dll’ or one of its dependencies

WhenI execute Pettycm the windows is white and doesn’t work, I need your Help I’v reinstalled the Pettycm it’s same…

Thank you

23 Waseem February 16, 2012 at 10:58 am

I am having issues with loggin on to putty. I used to be able to double click on the save session and it would load fine but now it does not work. it loads whatever under the host name and ignore the save session. Please advice….thanks!

24 daniel March 8, 2012 at 6:08 am

Hello Guys,

i’m sure you’ll like it :)
try the software Launchy and install the putty plugin. Start Launchy with alt+space and enter a session name. Better and faster than a shortcut.

regards,
daniel

25 Elaine June 15, 2012 at 12:09 pm

Thanks for the tips I picked up a couple I did not know. I have a question. A couple of times I accidentally copied a large block of text in putty (like from the cursor to the end of the window) without scrolling the text with the mouse button pushed down (takes forever). I am trying to re-create what I did because I frequently have a lot of text to copy. I also use “copy all to clipboard” but sometimes that crashes my putty session if there is a lot of data in the buffer. Not sure if that is a buffer overflow or what but at that point I am scrounging for the data in logs so I don’t do it very often. I allow a lot of lines in my buffer so I am sure that is it. Anyway anyone know how to copy without dong a mouse-click scroll through every line? The scrolling takes forever and half the time my finger accidentally comes off the mouse and I have to start over gain. Thanks!

26 SearayCA July 3, 2012 at 3:59 pm

Love the “Launch Most frequently Used PuTTY Session Quickly”. Excactly what I wanted.

27 Uldis August 8, 2012 at 4:42 am

How to arrange (sort) Putty sessions?
I have more that 30 routers in one folder, named from R1 to R30. But putty sorts them as it wish, like
R1 next R10, R11 …R2, R20, R21…
how can i sort this list if I wish, R1,R2,R3…
Is it possible??

28 daniel August 8, 2012 at 11:32 am

Hello Uldis,

the only way i know is to save as R01, R02, .. R10.. to become a sorted list.

regards,
daniel

29 Praveen August 30, 2012 at 8:17 am

Hi

Very useful..Thanks a lot

30 hejho September 13, 2012 at 9:01 am

I want to create the session logs into separate folders, but this way is not working:

C:\Users\blabla\Desktop\docs\logs\&H\&Y\&M\&H&D.log

It seems it isn’t create the new folders according using the variable, just the logfiles.
Do you know a way how I can solve it? I use many many server and it took minutes to open the folder of the logfiles.

31 daniel September 13, 2012 at 1:20 pm

Hello hejho,

it seems that putty is unable to create folders. You could create and start a vb script instead putty directly to check and create folders before starting putty by script. With vbs you can read ini.file or registry to find out existing hosts or to keep script simple create the &H folder manually.

regards,
daniel

32 Kiran September 17, 2012 at 11:55 pm

hi
is there any short keys to copy the o/p of file (when i give cat file) in single shot instead of dragging my mouse to copy to clipboard.

33 Thorarinn January 8, 2013 at 4:29 am

Thanks for the excellent tips

34 Ron January 9, 2013 at 10:10 pm

Hi Kiran,

You can copy the contents of a file to the clipboard by doing the following:

Right-Click the putty title bar
Select “Clear Scrollback”
cat /the/file
Right-Click the putty title bar
Select “Copy All to Clipboard”

Ensure that your Scrollback is big enough (Settings | Window | Lines of scrollback)

Ron

35 Anonymous January 30, 2013 at 11:45 pm

Hi, thanks for the good article. How to change the colour of background?

36 Puttycm user February 22, 2013 at 10:56 pm

I have windows 7 on my system, initially putty CM used to work fine for me. but recently a problem started when I try logging in using the auto log option. The password is getting displayed at the user name tab and then prompting to enter password !!! anyone know how to solve this problem?

37 Dave March 4, 2013 at 2:47 am

When you set the session name, this is overwritten by user@host on login.

Setting the bash profile doesn’t work for me, as I am logging 10 sessions to same server, and want to name them so that alt+tab in windows shows me the name, so I can find the one I want quickly.

I don’t see the point of the “title” option if it does nothing, is there some way to force it?

38 KC April 4, 2013 at 1:44 pm

You know, I was going to ask, how does a bunch of stuff that’s clearly labeled in the UI constitute “Tricks You Probably Didn’t Know”? But, then I saw Dave’s question (and the one about background color, which hurts my head because the answer is SO obvious), and it became clear.
Dave, here’s an 11th thing that a lot of people probably don’t know…
In the PuTTY Configuration window, under Terminal -> Features, there’s a checkbox labelled, “Disable remote-controlled window title changing”. It does pretty much what you’d expect.
Of course the “title” option does something; so does the aforementioned checkbox. You get to decide how you want them to interact.
For Anonymous, a 12th, really obvious thing…
Window -> Colours; under “Select a colour to adjust”, click “Default Background”; then enter RGB values, or click “Modify” and use the picker.
For Elaine (if you’re still listening), lucky #13… It is indeed tedious to click and drag to the edge of the screen and then wait for the window to scroll as you desire. The alternative is a bit less obvious…
Look at Window -> Selection; “Action of mouse buttons”. However you’re configured, one of the mouse buttons will have the function, “extends”. You can use this button to select a single character anywhere in the buffer; then use the PuTTY window’s scrollbar to scroll normally; position the pointer and click the “extend” button again; this action will select everything from the previously-selected character to the current position (inclusive). Experiment a bit and you’ll get the hang of it.

39 Neha Verma May 14, 2013 at 6:03 am

hi
Please tell me how to craete putty logs on linux server automatically

40 Justin Goldberg August 27, 2013 at 5:03 pm

Another great trick with PuTTy is change the default SSH session to send a NOOP command (to keep the ssh session open).

Connect to an ssh server, go to Change Settings, and under Connection, enter 60 for for the Seconds between keepalives. Click Apply and then go to Sessions and save it as the Default Session. Any other previously created ssh sessions will not have this parameter saved, only new ones.

41 Sal September 2, 2013 at 5:25 pm

I have a question about putty on win 7.

when i do a shift-> right click->cascade to restore all my windows,
all my window do get restored, but not of the size i have ROWS/COLUMN.

in ROWS/COLUMNS i specify 80 by 24 and when i open a new session
it opens as 80 by 24. but when I restore all my session with
shift-> right click->cascade they all open as size 138 by 30, which is too big.

any suggestion on how to control the size a “shift-> right click->cascade”
restored window?

Thanks
Sal

42 SukieC November 7, 2013 at 3:53 pm

I mainly use PuTTy to edit server files. Is there a way that the tab could display the File Name instead?

43 Karthikeyan .M November 22, 2013 at 4:17 am

Useful Tips !!! Keep it. Thank You !!!.

44 SandPond January 18, 2014 at 4:16 pm

You better backup the putty registry key a lot using this procedure:
Start
Run
regedit /e “%userprofile%\desktop\putty_bk1.reg” HKEY_CURRENT_USER\Software\SimonTatham

Or, backup using a fixed path like:
regedit /e “C:\Program Files\WinSCP\PuTTY\Putty_Backups\putty_bk2.reg” HKEY_CURRENT_USER\Software\SimonTatham

Because if you don’t backup frequently, and every use “putty -cleanup” falsely believing that it is some kind of useful command, YOU WILL BE TOTALLY WIPED OUT IN A MILLISECOND !!! Using the “putty -cleanup” command will age you several years, whiten your hair, and curl your toenails. Hearken to the voice of experience.

45 SomeGuy February 8, 2014 at 2:11 pm

Thank you for the tip on fonts. I couldn’t get the font to change, but your tip #2 included the sub-tip of selecting the session and then editing fonts. I was under the impression that changing the font would be a global setting, but it’s per session. Now I have big friendly fonts on my PuTTY!

46 Ghufran February 13, 2014 at 6:27 am

Regarding setting title of putty window, i tried it.
However, it does not seem fully working
when I open the window, it shows the title that i set.
but as soon as i log in, the title is automatically changed back to what it used to be

Please advise
I am using putty version 0.63

Leave a Comment

Previous post:

Next post: