Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-27-2017, 07:32 PM   #16
Sheik Yabooty
LQ Newbie
Registered: Feb 2017
Posts: 1

Rep: Reputation: Disabled
UK keyboard

I have the same issue with backslash and pipe key being void using Ubuntu 16.04 (works fine on an identical machine running Ubuntu Studio 16.10) Sorry if this is old news - it is still pertinant to me, so I guess others?

I have managed to work out that the backslash key can be accessed by using the Alt Gr + the key to the right of zero, and the pipe key can be accessed by using the Alt Gr + the key to the left of one. Additional keys can also be found using using Alt+shift+key (result!)

I do not know why the standard backslash/pipe key does not function at all in Ubuntu, but works fine in Ubuntu Studio?
The sudo nano /etc/default/keyboard file has "pc105" for XKBMODEL and "gb" for XKBLAYOUT on both machines, both are the same Dell 105 key UK keyboards. Hope this is of some help to someone.
Old 02-27-2017, 07:45 PM   #17
Senior Member
Registered: Sep 2010
Location: Lawrence, New Zealand
Distribution: Slackware
Posts: 1,077

Rep: Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732Reputation: 732
That's a good tip.

Another way round your problem is to map the backslash and pipe to the key you want, manually, with Xmodmap. I had to do this on my laptop because I bought it secondhand, and it came with a non-US keyboard. Since I use Dvorak layout anyway, most of the keys not being "right" didn't bother me, but some keys needed extra assistance to get where they were supposed to be.

In a file called ~/.xmodmap:

keycode 51 = backslash bar backslash bar
The key code may NOT be 51 in your case, but that seems to be pretty common.

To find out for sure, launch `xev` from a terminal. Then press the key that should produce the backslash. In the terminal output, look for `keycode` and then [some number]. That's the keycode you want to use.

To test, use the xmodmap command:

$ xmodmap ~/.xmodmap
Now your backslash and pipe should work as expected.

If so, add that xmodmap command to your ~/.bash_profile or ~/.bashrc file.

Last edited by notKlaatu; 02-27-2017 at 07:47 PM.
Old 02-28-2017, 11:19 AM   #18
LQ Veteran
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,084

Rep: Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279Reputation: 2279
If you can't find backslash and bar (\|), here's what to do.

1. Open a terminal and enter the command "setxkbmap -print". The output will include a line starting like
xkb_symbols {include "pc+gb"
That shows that I have a driver that includes the basic keys (pc, for things like SPACE) and the British layout (gb).

2. Now you know your layout name, look at its file in the folder /usr/share/x11/xkb/symbols/
Search that file for "backslash" and for "bar" to find where they are. The file may start with an "include" statement, so if it says "include latin(type 4)" you may have to search the "latin" file as well.

The alphanumberic keys are labeled by A plus a letter for the line (from A for the space bar to E for the top line) plus the number in the line. Thus AC02 is the second key in the home row: S. Three keys have special designations. TLDE is at the top left. LSGT is to the left of Z. BKSP is at the right end of the home row on international keyboards but at the right end above ENTER on US keyboards.

Each entry will have 2 or 4 symbols listed: basic, Shift + basic, AltGr + basic, AltBr + Shift + basic. So if your keyboard was Spanish (es), you'd get
key <AE11> {[ apostrophe, question, backslash, questiondown ]};
key <AE01> {[ 1, exclam, bar, exclamdown ]};
That shows you that both backslash is on "'", bar is on "1", and both need the AltGr key.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to type backslash and the vertical line in the terminal? WillingToLikeLinux Linux - Newbie 10 06-11-2009 12:24 PM
AltGr key does not work OlegL Debian 5 09-17-2004 02:22 AM
AltGr key does not work OlegL Linux - Laptop and Netbook 2 08-30-2004 09:35 AM
How do I type 0 with a slash thru it? kc0cxa Linux - General 2 03-05-2004 11:44 PM
Slash is back up. jeremy LQ Suggestions & Feedback 0 09-04-2000 01:55 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration