On earlier versions of Ubuntu, the AltF☒ and Alt shortcut keys for switching between virtual terminals seem to have been disabled under X Windows, so it wasn't possible to trigger them accidentally.

I'm now using Ubuntu 16.04 with Cinnamon desktop environment, and the shortcuts are enabled even under X Windows.

I frequently trigger them accidentally while trying to access menu items or to go forwards/backwards in a web browser.

How can I disable these virtual terminal shortcut keys, or replace them with the versions that require Ctrl (e.g. CtrlAltF1 instead of just AltF1)?


(I've found several older answers that suggest a custom xmodmap, but this seems to have no effect for me.)

3 Answers 3


For a permanent fix, you can add your modified mapping to /etc/console-setup/remap.inc.

You must run sudo dpkg-reconfigure console-setup -phigh to apply the changes and reboot.

For example, this what I use to disable alt-Fxx and alt arrow switching

# Remap alt+Fxx key to void to avoid terminal switching
alt     keycode  59 = VoidSymbol
alt     keycode  60 = VoidSymbol
alt     keycode  61 = VoidSymbol
alt     keycode  62 = VoidSymbol
alt     keycode  63 = VoidSymbol
alt     keycode  64 = VoidSymbol
alt     keycode  65 = VoidSymbol
alt     keycode  66 = VoidSymbol
alt     keycode  67 = VoidSymbol
alt     keycode  68 = VoidSymbol
# Also remove mapping for alt left arrow and right arrow
alt keycode 105 = VoidSymbol
alt keycode 106 = VoidSymbol



Try to use the command in terminal sudo kbd_mode -s and see if it helps. It changes keyboard input mode to "scancode". I had the same issue and found that this may be the solution.

  • Made my keyboard unusable on Ubuntu 19.04. Aug 23, 2019 at 20:31

This thread at Unix stackexchange helped me figure out a temporary one-off solution:

# This command removes all the lines that look like:
#    alt keycode 123 = Console_1'
# ... with no additional modifiers
$ sudo dumpkeys | grep -Pv '^\s+alt(gr)?\s+keycode\s+\d+\s+=\s+(Console_|Incr_Console|Decr_Console)'|sudo loadkeys

It seems that Ubuntu 16.04's console-setup package stores its cached keymap at /etc/console-setup/cached.kmap.gz.

But I can't figure out what program generates this "cache" in the first place. Any ideas? All I can tell is that re-running dpkg-reconfigure console-setup console-setup-linux triggers its regeneration.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .