1

Currently I'm using Ctrl + Alt + F1 to open tty1. This seems to be the default shortcut on all Linux distributions (at least, on the ones I tried until now).

Is there a way to change this into something like Ctrl + Alt + 1 (just 1 instead of F1)?

This is because my F* keys are on the same places like the numbers. To enable F, I need to press Fn–but this seems to be a limitation of my keyboard: when I press Ctrl + Alt + Fn + 1, nothing happens.

So, how can I change this tty shortcut? I am using the Raspbian.

5

If you are not in X and already at a virtual console, you do not need to use Ctrl and just Alt+F1 should work. If the keyboard issue is that it cannot handle 3 modifiers, this might help, but if the issue is that the Function key doesn't allow modifiers, then this won't help.

To get around this, if your keyboard has arrow keys, Alt+left/right arrow keys should cycle through virtual consoles.

If that still fails, you can use chvt(1), which you call with the form

$ chvt n

where n is a number for one of your virtual consoles. This allows you programatically to switch consoles without need to any special keyboard input.

Finally, if you want to completely change the shortcut, you can do this with loadkeys. From a virtual console you can run dumpkeys to output the keymap and you will see entries like

keycode  59 = F1               F13              Console_13       F25             
    alt keycode  59 = Console_1       
    control alt keycode  59 = Console_1 

which defines keycode 59 as F1 and then defines Alt+F1 and Ctrl+Alt+F1 to "Console_1". You could change the last two lines to

    alt keycode  2 = Console_1       
    control alt keycode  2 = Console_1

where keycode 2 is 1 (from dumpkeys output) and then load the modified keymap with loadkeys, and now you should be able to switch console 1 with Alt+1 or Ctrl+Alt+1

| improve this answer | |
  • In my case, the problem is that the pi boots into UI–because I still need some UI things–but the LCD and HDMI don't work together. To fix that I created two little scripts: enable-hdmi and enable-lcd. The problem occurs when I switch from HDMI monitor to LCD and forgetting calling enable-lcd before rebooting without HDMI. Then the pi boots into UI, but nothing appears on the LCD screen–however, virtual consoles work on the LCD screen. So, I cannot run commands, for that I really want to change that shortcut. What should I edit to change the last two lines? – Ionică Bizău Sep 6 '15 at 18:20
  • @IonicăBizău dump the keymap with dumpkeys into a file, edit that file to your liking and load it back in with loadkeys. – casey Sep 6 '15 at 18:24
  • Got it, but for some reason they get overridden (59 appears again after reboot). – Ionică Bizău Sep 6 '15 at 18:48
  • I will probably add my scripts to be ran at the boot time. – Ionică Bizău Sep 6 '15 at 18:50
  • its not persistent afaik. You'll want to setup a startup script (or use rc.local, or whatever mechanisms raspbian provides) to run loadkeys with your edited file when it boots. – casey Sep 6 '15 at 18:50

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.