Skip to content

Select text in linux console

MarcusE1W edited this page Sep 13, 2017 · 1 revision

To be able to selecet text using the Linux console (no GUI) you should create a file called supplemental.kmap and put the following inside it:

# The following is a map with supplemental key mappings for the linux console.
# Using these mappings will allow distinction between key presses for several
# keys with and without control and shift modifiers.

# These mappings can be loaded with the loadkeys(1) program. Simply run
#   loadkeys supplemental.kmap
# as root to add these mappings to your console. How to make these changes
# permanent depends on your distribution. There are also two ways to make these
# changes permanent: create a keymap which contains this file, or add a job
# which is run on startup and executes the above loadkeys command.

# Debian (or Debian based such as Ubuntu):
#   Add the contents of this file to /etc/console-setup/remap.inc and run
#   "dpkg-reconfigure -u keyboard-configuration" as root. Adding the mappings
#   to the remap.inc file will ensure that the mappings are activated, even if
#   another keyboard layout is chosen at a later time.

# Right
control keycode 106 = F100
shift keycode 106 = F101
control shift keycode 106 = F102
# Left
control keycode 105 = F103
shift keycode 105 = F104
control shift keycode 105 = F105
# Up
shift keycode 103 = F106
# Down
shift keycode 108 = F107

string F100 = "\033[1;5C"
string F101 = "\033[1;2C"
string F102 = "\033[1;6C"
string F103 = "\033[1;5D"
string F104 = "\033[1;2D"
string F105 = "\033[1;6D"
string F106 = "\033[1;2A"
string F107 = "\033[1;2B"

Then you can load it with sudo loadkeys supplemental.kmap. The terminal only remembers it for the current boot so you may want to run a job which runs at startup to execute the command.

Clone this wiki locally