October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

Change Keyboard Bindings and Shortcuts in the Linux Virtual Console

Learn the safe, current method for remapping keys in a Linux virtual console—without confusing VT keymaps with terminal-emulator or shell shortcuts.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This guide changes shortcuts in a Linux virtual console (VT/tty), the kernel-managed text consoles reached with combinations such as Ctrl+Alt+F3. It does not change GNOME Console, Konsole, xterm, SSH clients, Bash, Zsh, tmux, or desktop shortcuts. The workflow is to identify local keycodes with showkey, back up the active map with dumpkeys, create a small keymap, load it with loadkeys, and then make it persistent if required.

What you are changing

A keyboard shortcut can be handled by several different layers:

As an Amazon Associate I earn from qualifying purchases.

  • The physical keyboard and its input device.
  • The Linux kernel virtual-console keymap.
  • A shell line editor such as Bash Readline or Zsh.
  • A terminal emulator or multiplexer such as GNOME Console, Konsole, xterm, or tmux.
  • The graphical desktop or an individual application.

loadkeys changes only the second layer: the keymap used by a Linux VT. Linux documents virtual consoles as part of the kernel console-driver subsystem (kernel console documentation). A mapping loaded there will not automatically alter shortcuts in a graphical terminal window.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Open a real Linux virtual console

  1. Save work in your graphical session.
  2. Press a switching combination such as Ctrl+Alt+F3.
  3. Log in at the text prompt.
  4. Run the discovery and loading commands in that console, not in a terminal emulator.
  5. Return to the graphical session with its assigned function key, often Ctrl+Alt+F1 or F2. The exact key depends on the distribution and display-manager configuration.

Switching keys themselves can be intercepted by the kernel or desktop, so choose an available VT and test there.

#1 Best Overall
Sale
Amazon Basics Wired QWERTY Keyboard, Works with Windows, Plug and Play, Easy to Use with Media Control, Full-Sized, Black
  • KEYBOARD: The keyboard works for Windows with hot keys that enable easy access to Media, My Computer, Mute, Volume up/down, and Calculator
  • EASY SETUP: Experience simple installation with the USB wired connection
  • VERSATILE COMPATIBILITY: This keyboard is designed to work with multiple Windows versions, including Vista, 7, 8, 10 offering broad compatibility across devices.
  • SLEEK DESIGN: The elegant black color of the wired keyboard complements your tech and decor, adding a stylish and cohesive look to any setup without sacrificing function.
  • FULL-SIZED CONVENIENCE: The standard QWERTY layout of this keyboard set offers a familiar typing experience, ideal for both professional tasks and personal use.

Step 1: discover the keycodes on this machine

Keycode numbers should not be copied from a tutorial. They can differ with hardware, firmware, kernel behavior, and the console in use. In the target VT, run:

sudo showkey --keycodes

Press and release each key you intend to use, including the modifier combination. showkey reports the kernel keycode for use in personalized keymaps; its --keycodes mode is the relevant one for ordinary key definitions (showkey documentation). Record the numbers and stop the program with Ctrl+C.

  • A modifier state may select a different keymap entry without creating a new physical keycode.
  • Some combinations are consumed by VT switching, SysRq, firmware, a desktop, or another input layer before an application can use them.
  • Unusual keys may emit scancodes that the kernel does not yet map. Such a key can require setkeycodes before it is useful in a keymap.

Step 2: back up the active console map

Before experimenting, save the current translation tables:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo dumpkeys --full-table > "$HOME/virtual-console-keymap.backup.kmap"

dumpkeys writes the active tables in keymap format; --full-table makes modifier combinations explicit (dumpkeys documentation). Keep a copy somewhere you can reach from another VT or a recovery shell, rather than relying only on the console you are about to change.

To restore the saved map later:

sudo loadkeys "$HOME/virtual-console-keymap.backup.kmap"

Step 3: write a small keymap override

Keymap files are line-oriented. They can contain modifier maps, key definitions, strings, compose rules, comments, and includes. The basic form is:

Rank #2
Sale
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
  • All-day Comfort: The design of this standard keyboard creates a comfortable typing experience thanks to the deep-profile keys and full-size standard layout with F-keys and number pad
  • Easy to Set-up and Use: Set-up couldn't be easier, you simply plug in this corded keyboard via USB on your desktop or laptop and start using right away without any software installation
  • Compatibility: This full-size keyboard is compatible with Windows 7, 8, 10 or later, plus it's a reliable and durable partner for your desk at home, or at work
  • Spill-proof: This durable keyboard features a spill-resistant design (1), anti-fade keys and sturdy tilt legs with adjustable height, meaning this keyboard is built to last
  • Plastic parts in K120 include 51% certified post-consumer recycled plastic*
keymaps 0-127

shift keycode <KEYCODE> = <ACTION>

The keymaps declaration identifies the modifier maps used by the file. Use symbolic actions where possible. To inspect the action names supported by the installed tools, run:

dumpkeys --long-info

Symbolic names are generally more portable than raw numeric action codes, whose values can vary between kernels (dumpkeys documentation). The keymap grammar and keycode syntax are described in the kbd keymaps manual and Linux keymaps manual.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Example: use Shift+Up and Shift+Down for console scrolling

This example replaces the existing Shift-plus-page-key behavior only if your console’s scroll actions support those symbols. First obtain the actual arrow-key numbers with showkey --keycodes, then create a file:

nano "$HOME/virtual-console-scroll.kmap"

Enter the following, replacing both placeholders with the values you recorded:

keymaps 0-127

shift keycode <UP_KEYCODE> = Scroll_Backward
shift keycode <DOWN_KEYCODE> = Scroll_Forward

The names describe console actions, but visual direction can feel opposite to what you expect. Test both keys and exchange Scroll_Backward and Scroll_Forward if necessary. Do not treat fixed values quoted in older tutorials as authoritative; the original example at DZone is best regarded as a syntax example, and its arrow/page assignments appear inconsistent with commonly reported numbering.

Rank #3
Rii RK907 Ultra-Slim Compact USB Wired Keyboard for MAC and PC-Black(1PCS)
  • A plug-and-play USB connection with Low-profile keys give you a quiet, comfortable typing experience
  • Simple Wired USB Connection,You will enjoy a comfortable and quiet typing experience
  • The keyboard for business and office working is the budget-friendly keyboard that is built for longer use
  • Low profile keys for a more comfortable and quiet keystroke, desktop-centric design, splash resistant

Step 4: load and test the map temporarily

Load the file into the active virtual console:

sudo loadkeys "$HOME/virtual-console-scroll.kmap"

Generate enough output to create console scrollback, then try the new combination. This change is normally temporary: it affects the current console map and may disappear when console setup runs again or the machine reboots.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a one-off experiment, you can send a map through standard input:

sudo loadkeys <<'EOF'
keymaps 0-127
shift keycode <UP_KEYCODE> = Scroll_Backward
shift keycode <DOWN_KEYCODE> = Scroll_Forward
EOF

A saved file is preferable for anything you may need to audit, revise, or restore.

Step 5: make a custom binding persistent with systemd

For an ordinary language layout, use your distribution’s supported configuration instead. For an arbitrary action remapping, a dedicated oneshot service is clearer than a cron job.

Install the keymap

sudo install -D -m 0644 
  "$HOME/virtual-console-scroll.kmap" 
  /etc/virtual-console-scroll.kmap

The location under /etc is distribution-neutral. Some distributions instead use directories such as /etc/console-setup.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
Logitech MK120 Full Size Wired Keyboard and Mouse Combo - Black
  • Durable and Reliable: This USB keyboard features a curved space bar, spill-resistant design (2), durable keys that can withstand 10 million keystrokes, and sturdy, adjustable tilt legs
  • Comfortable, Familiar Typing: You’ll enjoy a comfortable and familiar typing experience thanks to the deep-profile keys and standard layout with full-size F-keys and number pad
  • Full-size Sculpted Mouse: The high-definition optical USB mouse puts comfort and control in your hands with smooth, accurate tracking and an ambidextrous shape that feels good hour after hour
  • Simple Set-Up: Simply plug the keyboard and mouse into the USB ports on your desktop, laptop, or netbook and you're ready to work; compatible with Windows 7, 8, 10 or later
  • Clear and Convenient: The bold, bright white and long-lasting characters make the keys on this PC or laptop keyboard easy to read and extra durable

Create the unit

Check the executable location first:

command -v loadkeys

Then create the service:

sudo nano /etc/systemd/system/virtual-console-keymap.service
[Unit]
Description=Load custom Linux virtual-console keymap
After=systemd-vconsole-setup.service
[email protected]

[Service]
Type=oneshot
ExecStart=/usr/bin/loadkeys /etc/virtual-console-scroll.kmap
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

If command -v loadkeys returned another path, substitute it for /usr/bin/loadkeys. The ordering shown is a useful starting point, but a distribution that reloads its console map later may require different ordering.

Enable, inspect, and test

sudo systemctl daemon-reload
sudo systemctl enable --now virtual-console-keymap.service
systemctl status virtual-console-keymap.service
sudo systemctl restart virtual-console-keymap.service

A systemd unit provides explicit ordering, status, and journal logging. To remove the persistent change:

sudo systemctl disable --now virtual-console-keymap.service

/etc/rc.local and cron @reboot jobs may work as compatibility techniques, but systemd describes rc.local as compatibility support and recommends a proper unit for new configuration (rc-local.service documentation).

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use the distribution layout tools for layout changes

If the goal is a layout such as US, UK, German, or Dvorak rather than a custom action, use the system’s console configuration:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
localectl list-keymaps
localectl status

localectl manages system and virtual-console keyboard mappings; it is not a complete editor for arbitrary shortcuts such as “make Shift+Up invoke scrollback” (localectl manual). On systems using systemd-vconsole-setup, /etc/vconsole.conf and boot/initramfs configuration can determine the default map. Tools such as dracut can include that configuration in the initramfs (dracut documentation).

Best Value
Sale
Lenovo 300 USB Keyboard, Wired, Adjustable Tilt, Ergonomic, Windows 7/8/10, GX30M39655, Black
  • The Lenovo 300 USB keyboard offers an intuitive and comfortable island key design with 2 5 zone layout including separate number pad
  • This full-size keyboard includes concaved key caps fitted for your fingertips
  • Spill resistant keys with a board drain help keep your PC keyboard protected and keep you productive
  • The complete ergonomic design includes an adjustable tilt to improve your typing comfort
  • OS independent – This convenient computer keyboard works with laptops desktops and any computer with a USB port

When loadkeys is the wrong tool

Desired behavior Use instead
Command-line editing in Bash Bash Readline settings, usually ~/.inputrc
Command-line editing in Zsh Zsh keymaps and widgets
Tabs, panes, copy/paste, or zoom in a terminal window The terminal emulator’s settings
Pane and session controls tmux configuration
Desktop-wide application shortcuts Your desktop environment’s keyboard settings
Keyboard behavior in an SSH session The local terminal, shell, or multiplexer; SSH normally does not expose the remote machine’s physical VT

Troubleshooting and recovery

The map is rejected

  • Confirm that you are on a real VT, not a graphical terminal emulator.
  • Check the declaration and syntax in the file.
  • Verify that the action exists: dumpkeys --long-info | less.
  • Check the executable and load verbosely: command -v loadkeys followed by sudo loadkeys -v /etc/virtual-console-scroll.kmap.
  • Use root or equivalent privileges.

The change disappears

That is normal for a manual loadkeys invocation. Install and enable the service, or use the distribution’s console configuration for a layout change.

It works on one VT but not another

Test the target VT directly. Virtual terminals can have separate active maps, and a display manager or console-setup service may reload one later.

The graphical desktop is unchanged

This is expected: graphical applications use their own input stack rather than the kernel VT keymap.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Ctrl or Alt combinations do not work

Try a non-conflicting combination. VT switching, SysRq, desktop global shortcuts, firmware, and other console functions can consume the same keys.

Restore a bad mapping

  1. Switch to another VT and log in as an administrator.
  2. Restore the saved map:
sudo loadkeys /path/to/virtual-console-keymap.backup.kmap
  1. Disable the persistent unit if it keeps reloading the bad file:
sudo systemctl disable --now virtual-console-keymap.service

If every VT is unusable, use a recovery shell or another administrative access path. Do not experiment with Ctrl+Alt+Delete, SysRq, emergency, or Secure Attention Key combinations unless you understand their consequences; special console mappings can terminate processes holding /dev/console (Linux Secure Attention Key documentation).

Scrollback is unavailable

Keyboard scrollback depends on the kernel console driver, distribution configuration, and whether you are actually in a VT. GPM can add mouse support and cut-and-paste, but it is not a universal prerequisite for keyboard scrolling.

Quick Recap

SaleBestseller No. 1
SaleBestseller No. 2
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Plastic parts in K120 include 51% certified post-consumer recycled plastic*; Product carbon footprint: 4.02 kg CO2e
$12.39
Bestseller No. 3
Rii RK907 Ultra-Slim Compact USB Wired Keyboard for MAC and PC-Black(1PCS)
Rii RK907 Ultra-Slim Compact USB Wired Keyboard for MAC and PC-Black(1PCS)
Simple Wired USB Connection,You will enjoy a comfortable and quiet typing experience
$9.99
SaleBestseller No. 4
Logitech MK120 Full Size Wired Keyboard and Mouse Combo - Black
Logitech MK120 Full Size Wired Keyboard and Mouse Combo - Black
Product carbon footprint: 5.03 kg CO2e
$17.77
SaleBestseller No. 5
Lenovo 300 USB Keyboard, Wired, Adjustable Tilt, Ergonomic, Windows 7/8/10, GX30M39655, Black
Lenovo 300 USB Keyboard, Wired, Adjustable Tilt, Ergonomic, Windows 7/8/10, GX30M39655, Black
This full-size keyboard includes concaved key caps fitted for your fingertips; The complete ergonomic design includes an adjustable tilt to improve your typing comfort
$13.39

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.