7

I am working on Windows PC. If I open a terminal (with PuTTY or SSH) to a Linux (CentOS) machine, I can't get keys like Esc, Ctrl, Shift and Alt to work.

I need them for Midnight Commander (currently Ctrl+Ins and Shift+Ins are not working for me). Is it possible to get these keys to work?

1
  • Have you tried other remote machines as well? You might be able find out whether a setting in PuTTY or whether the CentOS system is the problem. – foraidt May 12 '15 at 11:51
3

Putty emulates a terminal which is connected to the Unix machine via serial (RS232c) connection. Look here for configuration options. Typical terminal types include vt100, vt200, xterm, ansi.

To get proper operation, your Unix environment variable TERM has to match the type of terminal being emulated (cf. Putty configuration Connection/Data/Terminal-type). I am using xterm, also for text-mode console windows.

Use echo $TERM as command to find the current value.

Esc is the first character of terminal control sequences. Therefore, it typically should not be used as stand-alone character. Ctrl, Shift and Alt on their own do not trigger any character to be sent to your Unix machine. You can make use of the Putty configuration menu Terminal/Keyboard to influence how certain keys are translated.

1
  • How does it actually answer the question? Keys like Shift/Ctrl/etc don't work. How to make them work? – The Godfather Mar 17 '20 at 9:03
2

Although PuTTY sets the TERM variable to xterm, its behavior does not in fact match xterm's behavior. There are two features mentioned in the question:

  • Escape as a prefix returned by special keys is provided by xterm as an alternative to the meta key (see the discussion of eightBitInput in the manual).
  • the other keys (Control, Shift and Alt) are typically used as *modifiers. That is, they usually do not send characters by themselves, but modify the behavior of a key pressed at the same time.

The ncurses FAQ How can I use shift- or control-modifiers? presents some of the background for modified keys. PuTTY does not implement any of that. It does modify the control sequences sent by a shifted cursor key, switching between normal and application modes (see the xterm FAQ Why can't I use the cursor keys in (whatever) shell? for some discussion of those terms).

ncurses has an accurate terminal description for the default configuration of PuTTY (several descriptions could be created to correspond to its keyboard dialog settings, but in practice those are rarely mentioned, probably rarely used). Systems with a complete terminal database will have that putty terminal description.

Like other terminal emulators which set TERM to xterm, a complete terminal description has a lot of differences versus xterm. The ncurses FAQ Why not just use TERM set to "xterm"? gives an overview to that aspect.

The mention of ssh hints that you may be using mintty with Cygwin. That is a descendant of PuTTY, with about the same limitations.

2
  • So what is the solution for the asked question? None? Don't use PuTTY? Or anything else? – The Godfather Mar 17 '20 at 9:07
  • PuTTY won't do what OP was requesting. Others might use PuTTY with different requirements. mintty might do part of what was requested, but OP didn't respond to that point (probably not using mintty). – Thomas Dickey Mar 17 '20 at 9:21
0

The answer is you can't, since this is a bug in PuTTY.

There is KiTTY which is fork of PuTTY and which has implemented proper Ctrl/Shift support, you may want to take a look on it.

Source: https://superuser.com/a/1226621/360137

And just a side note - by default KiTTY has Ctrl+Up/Down as transparency control hotkey, so you may want to disable transparency completely by setting Window->Transparency to -1 as default value for the sessions.

0

As other people have mentioned, PuTTY does not really work. KiTTY is better, but it does not provide all the keys I need. So far, I find mintty (shipped with Git Bash for Windows) works the best. Specifically, its "Options > Keys" provide tunings to disable Ctrl/Shift-Ins as Copy/Paste, but use them literally for the TTY.

0

I, as author of putty4far2l putty fork, suggest you to try «far2l + putty4far2l» for similar to «mc + putty» user expirience, but with full keyboard support. This is available through so called «far2l terminal extensions». If you run mc inside far2l inside putty4far2l, full keyboard support will become available in mc too.

PS: ppa for far2l is here, putty4far2l's binary is available directly on github

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.