How can I type a backslash with no backslash key?

452,048

Solution 1

I have now remapped planking L (¬) to backslash (\) using the following shell script at startup. I am using gnome / Ubuntu 13.10 on an Asus Zenbook.

#!/bin/sh
xmodmap -e "keycode 49 = grave backslash grave notsign bar bar bar bar grave asciitilde"

Solution 2

I have found out that Alt Gr+- gives \.

Solution 3

Press the alt key to the right of the space bar (alt gr), and the key above the enter key (which should typically be hash on a US keyboard set to UK input - but on your laptop it is actually the \ key!). This should provide a backslash!

altGR+#( \ )key

Solution 4

If you do not have Alt GR in your keyboard, simply press and hold left ALT then type 92.

Solution 5

You can find a full list of ALT codes here.

Or try Alt+Shift+:

On the German keyboard backslash is Alt+Shift+7

Share:
452,048

Related videos on Youtube

wim
Author by

wim

Hi from Chicago! Python dev with interest in mathematics, music, robotics and computer vision. I hope my Q&A have been helpful for you. If one of my answers has saved your butt today and you would like a way to say thank you, then feel free to buy me a coffee! :-D [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click*

Updated on September 18, 2022

Comments

  • wim
    wim over 1 year

    I'm trying to use a UK keymap on a physical US keyboard on my notebook (Asus Zenbook UX31E). My keyboard has vertical bar and backslash (| and \) above the Enter key, but I get hash and tilde instead. On UK keyboards, pipe and backslash seem to be just to the left of the Z key. Unfortunately, I don't have that physical key at all; instead, I just have a fat left Shift key. They needed an extra key to make room for £ and €, so things have moved around a bit, I guess.

    I need vertical bar (for pipe) all the time in Linux, and, fortunately, found that with Right Alt+`.

    Is there any similar trick for getting a backslash?  Unfortunately, I don't have a numeric keypad, so I couldn't get an escape sequence like Alt+92 working.

    By the way, Shift+` gives me the "not" sign, ¬ (which I call "planking L").  I don't think I'll ever need that, so whilst an existing sequence to get a backslash is preferable, a solution that allows me to map backslash onto Shift+` is also acceptable to me.

    By the way, I am using Gnome / Ubuntu 13.10.

    • Admin
      Admin over 10 years
      Well, the key to the left of the Z key seems to only be there on UK keyboards. Perhaps you should switch to the "international" keyboard layout that puts the UK pound on RightAlt+Shift 4 and the Euro on RightAlt 5.
    • Admin
      Admin over 10 years
      I used to use a UK keyboard with a Japanese IME input. For some reason, backslash was not mapped and instead ¥ (yen) worked as a perfect replacement in terminal.
    • Admin
      Admin over 10 years
      you could try to make your own keyboard layout with MS KLC (microsoft keyboard layout creator) that might work.
    • Admin
      Admin over 10 years
      please include a screenshot of the keyboard, that may help some people think of things. or others see the problem more clearly. And by the way, why not use a US layout for the US keyboard?
    • Admin
      Admin over 10 years
      also, I found this comment on a forum, it may help. "I had the same problem, and it took me a long time to figure it out. In the top row of keys, right after the F* keys I finally found a small blue picture of a lock. This is the number lock key. Push the FN and the number lock key once to turn on the 10key function in the Qwerty keys and push them both again to turn it off." That said, I see no lock here though I can't zoom in much replacementlaptopkeys.com/images/…
    • Admin
      Admin over 10 years
  • wim
    wim over 10 years
    Unfortunately, Alt + Shift + : gives me no output. And I can't enter alt codes because I don't have a numeric keypad.
  • Daniel R Hicks
    Daniel R Hicks over 10 years
    @wim - I've never seen a keyboard sans keypad that didn't have the numeric keys "shadowed" on the right-hand side of the alpha keyboard. To access it you use "NumLk".
  • wim
    wim over 10 years
    @DanielRHicks I've heard of numeric keypads being accessible with 7,8,9,U,I,O,J,K,L on notepads before, but I've never got it working because I don't seem to have a num lock key! Unless it is some obscure sequence. There isn't anything obviously labelled NumLk on my keyboard.
  • Daniel R Hicks
    Daniel R Hicks over 10 years
    On my keyboard (on a Sony Vaio) with identical layout the NumLk key is to the right of F12. But those 4 keys on the right are labeled differently from mine.
  • wim
    wim almost 10 years
    I mentioned in the post that this gives me planking L ¬
  • Rory
    Rory over 9 years
    This works for me using a physical US (ms surface pro 3) keyboard running in UK mode in windows 8. Also note Windows-SPACE switches between languages in windows, which can be really helpful.
  • dorien
    dorien almost 9 years
    omg if I had know this sooner, it would have saved me a year of switching gb-us all the time...
  • yass
    yass about 7 years
    It depend of the Keyboard and Language
  • m3dl
    m3dl over 3 years
    It worked here! Thank you!
  • boardtc
    boardtc over 3 years
    Doesn't work for me for some reason :-(
  • Markus Bawidamann
    Markus Bawidamann almost 3 years
    Nope, does not work.
  • Admin
    Admin almost 2 years
    Thank you for this simple solution. note for others: this only works with the - above the keyboard, not the - on the numpad.