Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know these layouts have two-letter codes like us for the US layout. I need a list of all the layouts available and also to pair the two-letter codes to the proper names of the layout to get the not so trivial ones.

share|improve this question
Does the following link help with your question? [How do I enumerate all available keyboard layouts in X.org?][1] [1]: stackoverflow.com/questions/1268572/… – tink Mar 18 '13 at 22:20
That one sounds interesting but I need a step by step guide to use that. My knowledge of Ubuntu peeks at I can install and run it from an USB flash drive. There is no clear documentation on X.org-s home page of the available layouts? That would seem logical from an open source project. – superuser Mar 18 '13 at 22:59
up vote 0 down vote accepted

Open a text editor. Copy the code from the stackoverflow question mentioned in the comment to the file. Save the file with the name "getkbdlayouts.py".

Then open a console window. In that window, type

chmod +x getkbdlayouts.py

You may get an error like ImportError: No module named lxml.etree. If so, you need to install the package python-lxml (usually by running apt-get python-lxml).

share|improve this answer

I'm not sure why you'd need a full blown xml parser and a dozen lines of python code when you can simply run

sed '/! layout/,/^$/!d;//d' < /usr/share/X11/xkb/rules/evdev.lst

to get the layouts list:

  us              English (US)
  af              Afghani
  ara             Arabic
  al              Albanian
  am              Armenian
  ...             ........
  ...             ........
share|improve this answer
and a python virtual environment manager, and three or four python package managers, probably some code color parsers, several dozen 10+ CAPS char name environment variables... several config files of various arbitrary formats... – mikeserv Nov 27 '15 at 19:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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