PuTTY

From Omnia
Revision as of 21:18, 17 May 2024 by Kenneth (talk | contribs) (→‎PuTTY)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

PuTTY

PuTTY
https://www.chiark.greenend.org.uk/~sgtatham/putty/

PuTTY is a free implementation of SSH and Telnet for Windows and Unix platforms, along with an xterm terminal emulator. It is written and maintained primarily by Simon Tatham.

Alternatives

See KiTTY

See PuTTie

Download

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

My Putty Default Settings

# Increase scrollback lines
- Window
    => Lines of scrollback: 20000
# Change data and character set
- Window
    Translation
        => Received data character set: UTF-8
- Connection
    Data
        => Terminal-type string: linux
# Change color to green theme
- Window
    Colours
        => Colours - Default Forground: 0 255 0
# Keep connections alive
- Connection
    => Seconds between keepalives: 30

---

If you are having issues with vim and white space collapse, use: [1]

- Connection
    Data
        => Terminal-type string: linux

Note: the above will cause the scroll back to not work in screen, or the keypad to work.

# Getting numbers from Numeric keypad in VIM
# No longer needed with above settings
Terminal
    Features
        => Disabled application keypad mod: checked
    Keyboard
        => Function keys and keypad: Linux

Recovering from CTRL+S in Putty

Apparently CTRL-S actually does XOFF, which means the terminal will accept key strokes but won’t show the output of anything. It will appear as if your terminal is dead when it’s really just waiting to be turned back on. The fix? Simply press CTRL-Q to turn flow-control on (XON). If you pressed a whole bunch of keys before pressing CTRL+Q, you’ll see the output from those keystrokes.

CTRL-S - XOFF
CTRL-Q - XON

Profiles

The putty profiles are stored in the registry here:

HKEY_CURRENT_USER\Software\SimonTatham\PuTTY

To export the registry:

regedit /ea putty.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY

Full Screen

"If you find the title bar on a maximised window to be ugly or distracting, you can select Full Screen mode to maximise PuTTY "even more". When you select this, PuTTY will expand to fill the whole screen and its borders, title bar and scrollbar will disappear. (You can configure the scrollbar not to disappear in full-screen mode if you want to keep it)

When you are in full-screen mode, you can still access the system menu if you click the left mouse button in the extreme top left corner of the screen."

Source: [2]

Title

Change title:

Change Settings... -> Window -> Behavior -> Window title

putty-name-window-2.png

Disable title change:

Change Settings... -> Terminal -> Features -> Disable remote-controlled window title changing

Change title from command line: Change title from command line:

echo -e "\033]0;`hostname`\007"
echo -e "\033]0;MY NEW TITLE\007"
TITLE="hello worldd"
echo -e "\033]0;${TITLE}\007"

Cool prompt that auto updates title: [3]

export SERVER=$(hostname)
case "$TERM" in
xterm*|rxvt*)
    PROMPT_COMMAND="\033]0;${SERVER}\007"
    echo $PROMPT_COMMAND
    ;;
*)
    ;;
esac

Setting the PuTTY window title from command line [4]

function wtitle {
    if [ "$TERM" == "xterm" ] ; then
      # Remove the old title string in the PS1, if one is already set.
      PS1=`echo $PS1 | sed -r 's/^\\\\\[.+\\\\\]//g'`
      export PS1="\[\033]0;$1 - \u@\h:\w\007\]$PS1"
    else
      echo "You are not working in xterm. I cannot set the title."
    fi
}

Kenneth's modification of the above, that works really well!

function wtitle {
  echo -e "\033]0;${1}\007"
}

shell version /usr/local/bin/wtitle

#!/bin/bash
echo -e "\033]0;${1}\007"

References:

Sessions

  • PuTTY Trick 9. Move Putty sessions to another computer
  • PuTTY Trick 10: Launch Most frequently Used PuTTY Session Quickly

References:

keywords