41

I've never used linux before, so this may be a problem with that, but I'm trying to simply SSH into my friends webserver using the info he gave me. I looked up that the linux command to ssh is ssh username@hostname. I'm not trying to type that into LXTerminal but everytime I hold shift and hit the number two I don't get @ I get ". Any ideas?

  • 7
    The @ is mapped to the " key in the UK. – Jivings Jul 13 '12 at 21:46
  • 2
    By the way, I know this is probably irrelevent, but if you can't be bothered to do the remapping described below, you'll probably find that Shift+' will give @ (the key next to ;) If I guess correctly, this is the combination that normally would give you " – ACarter Jul 14 '12 at 13:04
  • Thank you for the keyboard combo "shift + apostrophe" to make @ symbol. It does work! I could not put my email address in the Netflix membership sign in. Appreciate it! Other than that, the Raspberry Pi is a great learning experience! – user3392 Nov 22 '12 at 4:23
  • BTW, Wikipedia has nice pictures of both US and UK layouts. – Dmitry Grigoryev Nov 23 '16 at 17:02
49

You need to remap your keyboard. By default it is set to a UK map.

at the command line type:

sudo nano /etc/default/keyboard 

and hit enter. locate the following line

XKBLAYOUT=”gb”

Change the gb to us (This assumes you want a us mapping, if not replace the gb with the two letter code for your country)

and reboot your machine.

if it pauses for a long time during the keyboard mapping stage, enter the following at the command line:

sudo setupcon

Your next reboot should be much faster.

Reference:

http://elinux.org/index.php?title=R-Pi_Troubleshooting&oldid=147362#Re-mapping_the_keyboard_with_Debian_Squeeze

| improve this answer | |
  • Just a note, if nano's not your editor of choice the pi comes bundled with vi as well. – piperchester Jan 19 '14 at 18:31
  • 1
    That is so wierd. Just saying.... – GreenAsJade May 2 '14 at 11:40
  • 2
    Raspbian users should make sure to see scruss's answer and/or this as an alternative. – goldilocks Sep 26 '15 at 12:09
  • Thesetupcon was crucial for me. Until then, the keyboard locale just wouldn't get updated. Thanks! – IgorGanapolsky Aug 14 '16 at 21:22
23

Steve's answer, though correct at the time, is now somewhat out of date. In Raspbian:

sudo raspi-config

and go to the configure_keyboard section with 4 Internationalisation Options -> I3 Change Keyboard Layout

You can choose the correct keyboard type and layout from there.

| improve this answer | |
  • 2
    Is this simply seen as a more user-friendly way of doing the exact same thing, or does this clear up additional problems that Steve's solution does not? – TimFoolery Dec 26 '15 at 19:49
  • Under Raspbian, it at least uses the official configuration tool. It may do additional things in the background. At least it sets up the console keyboard and X keyboard with one command, rather than Steve's two. – scruss Dec 27 '15 at 11:12
1

Raspberry Pi configuration has changed as of Jessie (2017):

  1. raspi-config no longer offers Internationalisation Options. The Localisation Options has no submenu for Change Keyboard Layout
  2. Simply setting XKBLAYOUT="us" may default to the Spanish layout.

This worked for me:

sudo nano /etc/default/keyboard

And these were my settings (I'm Canadian):

XKBMODEL="pc104"
XKBLAYOUT="ca"
XKBVARIANT="eng"

For our southern neighbors:

XKBMODEL="pc104"
XKBLAYOUT="us"
XKBVARIANT=""

There is, however, a bug with that. When you check in

Pi > Preferences > Raspberry Pi Configuration
Pi > Preferences > Keyboard and Mouse. 

it will show United States > Spanish (Latin American). I don't think it affects functionality.


To find out the layout you want, run this in the Terminal:

rc_gui

Then click on Localisation > Set Keyboard... and make your change. Click OK to close the Keyboard Layout dialog. Click Set Keyboard... once more. This time, the terminal window you will show:

Sections: ['Global']
Layouts: ['ca']
Variants: ['eng']
Options: []

Now you can put those into your

sudo nano /etc/default/keyboard

Layouts --> XKBLAYOUT
Variants --> XKBVARIANT
| improve this answer | |
  • I wanted to mention that searching for "change keyboard layout" brings up this answer that is very similar: raspberrypi.stackexchange.com/a/10103 But it doesn't mention that the US/Canada keyboard is pc104; I guess the Rest of the World (Latin-alphabet world outside of US/Canada) uses pc105? – Colin Mar 26 '18 at 19:24
0

Another option that doesn't use the Terminal is going into (from the GUI), Menu > Preferences > Raspberry Pi Configuration > Localization > Set Keyboard, and set it according to where you live.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.