I use a Turkish keyboard which i have converted to English(Ubuntu server 12.04). My problem is that the single quote is not present on the keyboard but is instead represent by a comma in midair. To fix this i use the command

sudo dpkg-reconfigure keyboard-configuration

The problem is each time i shutdown,changes are reverted thus everytime i start the system, i have to type that command. I was thinking of making it a cronjob but i`m sure there can be another way to make the changes permanent.


using sudo dpkg-reconfigure keyboard-configuration will change your keyboardlayout just for this session.

go for sudo nano /etc/default/keyboard there you can change your keyboard settings.

Find the line :


You can change layout and kboptions as well as your model and the kbvariant.

Just put in tr for Turkish

Keyboard File

on older ubuntu versions you could go for dpkg-reconfigure console-setup and make permanently changes here. but for server 12.04 I guess it should be in the keyboard file.

  • 1
    This does not work by ubuntu server 14.04. I replaced the "us" with "hu" (Hungarian), but after reboot I still have English layout instead of Hungarian. sudo dpkg-reconfigure keyboard-configuration worked for me, and it is permanent, I have Hungarian layout after reboot. – inf3rno Feb 5 '16 at 13:42
  • how can i get the values to put into these fields that are reconfigured by the 'keyboard-configuration' ? My keyboard turns british after reboots – y.selivonchyk Dec 15 '17 at 4:21

The keyboard settings are stored in /etc/default/keyboard file. It's provided by the keyboard-configuration package, and other packages use this information in order to configure the keyboard on the console or in X Window System.

You can change your keyboard settings using:

dpkg-reconfigure keyboard-configuration
service keyboard-setup restart


  • Welcome to Ask Ubuntu! ;-) Please review my edits – Fabby May 6 '18 at 10:52
  • 1
    Fabby, thank you for the clear and concise edit. :-) – OnePuttMike May 7 '18 at 12:00
  • This was it! I choose 104 key layout for my keyboard and after choosing the defaults after that, my keyboard is back to normal again. Thank you – smac89 Jul 18 '18 at 17:39

I was having the same problem since last year and i was everytime setting the keyboard layout when starting the system. I tried all methods but none helped except one which i found helped me :)

  • Go > Applications > System tools > Preferences > Startup Application
  • Add new
  • Name: Default Keylayout
  • Command: setxkbmap us
  • Save

Restart the system :)

  • 1
    Probably the easiest solution. Also worked for my Belgium azerty keyboard using 'setxkbmap be', for which I was struggling (because it's a slight variation of the French keyboard and Ubuntu seems a bit lost trying to recognize it) – Pascal Jun 27 at 4:53

To change it permanently via the terminal run this:

For US:

L='us' && sudo sed -i 's/XKBLAYOUT=\"\w*"/XKBLAYOUT=\"'$L'\"/g' /etc/default/keyboard

For French:

L='fr' && sudo sed -i 's/XKBLAYOUT=\"\w*"/XKBLAYOUT=\"'$L'\"/g' /etc/default/keyboard

For German:

L='de' && sudo sed -i 's/XKBLAYOUT=\"\w*"/XKBLAYOUT=\"'$L'\"/g' /etc/default/keyboard

and so on...

Tested on Ubuntu 16.04 64 bit.

To change it temporarily you can use setxkbmap mylayout...

# US
setxkbmap us
# French
setxkbmap fr
# German
setxkbmap de

In terminal mode, you need to use loadkeys instead of setxkbmap

# US
loadkeys us
# French
loadkeys fr
# German
loadkeys de

For console-only instances e.g. servers, you should install the console-data package with apt-get install console-data and then set it up with dpkg-reconfigure console-data.


I tried all of the above on an Ubuntu 16.04 and only the temporary solution setxkbmap xx did it for me so I manually included it in the .bashrc profile: sudo nano ~/.bashrc and then type setxkbmap xxreplacing xx with yor language code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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