0

This question already has an answer here:

When I am am in virtual terminal and open my editor, I can use editor key shortcuts such as CTRL + Down and CTRL + Up to select lines (select block), or F5 and F6 to copy/move the selected block.

When I log in via console however, (tty, via CTRL + Alt + F1), these shortcuts no longer work. CTRL + Down and CTRL + Up act simply as Down and Up, F5 instead of copying selected block prints cappital letter E. Only the F6 works (moves selected block).

I believe this has nothing to do with my editor (joe), but instead has to do with settings of the console/terminal.

How can I use same keys in the tty console, as I do in virtual terminal.

marked as duplicate by Gilles, cuonglm, jimmij, Scott, Anthon Apr 20 '16 at 5:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Under Linux, I presume? – Gilles Apr 19 '16 at 22:22
  • @Gilles - thanks, but the linked answer seems little outdated, and does not explain where you got the keycodes from. – Martin Vegter Apr 20 '16 at 10:13
  • This stuff hasn't changed since the last century, so it isn't outdated. Look at the existing keymaps to find the keycodes. If you have trouble finding the right files to look at or edit in your distribution (different distributions use different file locations and package names), you could ask a question about that. – Gilles Apr 20 '16 at 10:28
0

The behavior is unrelated to settings of the console/terminal. Rather, it is a feature of the terminal (or terminal emulator) itself.

The terminfo database's predefined capabilities reflect existing practice across a few thousand terminal types. If you read through the list of predefined capabilities, you may notice that there are several definitions for shifted keys, e.g.,

   key_beg                   kbeg   @1   begin key

versus

   key_sbeg                  kBEG   &9   shifted begin key

There are no predefined capabilities for other modifiers such as control.

To make a long story short,

  • the hardware terminals which served as models for modern computer console/terminal and terminal emulators rarely used any modifier than shift, and that was not used pervasively.
  • computer console/terminal implementations tend to lag in development because they are part of the kernel, and innovations there interfere with stability
  • Linux and BSD consoles for instance are based (loosely) on existing practice in other terminals such as VT220 for Linux and SCO for the BSDs (technically Unix for the latter, but documented as SCO). A few changes have been made over the past twenty years, mainly with the BSDs adapting changes from xterm.
  • The BSD console as adapted from SCO provided combinations of shift and control to multiply the available function keys. rxvt provided a scheme like that around 1994.
  • VT220s do not modify special keys using control (or even shift, for that matter). A later DEC terminal model provides an option which was adapted in xterm in 1999, referred to as PC-style function keys.
  • The PC-style modifiers implemented in xterm went beyond the shift and control, adding alt and meta.
  • Other terminal developers copied the feature from xterm, and now (more than 15 years later), some users regard it as standard.
  • The extended special keys are supported in ncurses as "user-defined" capabilities; there is no standard which addresses this (or actually, any set of function-keys).

Further reading:

  • 1
    This doesn't really answer the question. The root cause is that the default key mappings on the Linux console map Ctrl+arrow keys to the same escape sequences as plain arrow keys. Your historical explanation is correct, but that can be changed by changing the settings of the console. – Gilles Apr 19 '16 at 22:34

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