Score:1

How to remap CapsLock to Esc key in Ubuntu installed on VPS (console only, no Desktop Environment)?

in flag

The goal is to remap CapsLock to Esc key in my Ubuntu 20.04 remote server (console only, no Desktop Environment).

This Ubuntu system is installed on Virtual Private Server. I'm logging to this server using Putty, from my home laptop with Windows 10.

And everybody are talking about mapping this CapsLock key to Esc, but I was unable to find actual line, that needs 2 be written.

I've run this:

michal@localhost:~$ localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc105

but I don't understand what VC Keymap means?

Should there be something other than n/a?

I've also tried creating /etc/vconsole.conf file and I've added a line there:

keycode 58 = Escape

but it changes nothing. Yes - I've rebooted my Ubuntu server.

I've read this help page:

but it's little to complicated 4 me, and I simply cannot extract the solution from there.

Score:3
uz flag

Try to edit /etc/default/keyboard and include the line:

XKBOPTIONS="caps:escape"
michal roesler avatar
in flag
Is this going to be a persistent change? Like for every time I login to the system will this swap CapsLock into Esc key?
Gunnar Hjalmarsson avatar
uz flag
@michalroesler: It will indeed be persistent. But I can't tell if it will be effective if you change it on the server and log in via ssh. Maybe it's rather your remote client you need to change.
michal roesler avatar
in flag
I've written `XKBOPTIONS="caps:escape"` into `/etc/default/keyboard` and rebooted the server, but CapsLock is still CapsLock. What do you mean by: "Maybe it's rather your remote client you need to change."
Gunnar Hjalmarsson avatar
uz flag
@michalroesler: I mean your Windows 10 machine. That's where the keyboard you are using is, right?
michal roesler avatar
in flag
Yes. I'm using the keyboard on Windows 10 machine in my home.
Jay _silly_evarlast_ Wren avatar
ca flag
I think the mapping is backwards. https://manpages.debian.org/testing/keyboard-configuration/keyboard.5.en.html says `XKBOPTIONS="ctrl:nocaps"` to map caps to ctrl, so I'd guess it should be XKBOPTIONS="escape:nocaps" to map capslock to escape.
Gunnar Hjalmarsson avatar
uz flag
@Jay_silly_evarlast_Wren: Better look at the complete list: https://manpages.ubuntu.com/manpages/xenial/en/man7/xkeyboard-config.7.html ( guessing is not a good approach in this case, I think. ;) )
Jay _silly_evarlast_ Wren avatar
ca flag
Indeed you are right. The definition seems inconsistent to me. I must be thinking about it incorrectly. Thank you for the correction. I'm happy to have found this post because I want "ctrl:nocaps" and it worked well for me.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.