Change from qwerty to azerty in command line

I start my command line in Ubuntu but if I type anything my keyboard is in qwerty. I want to change it to azerty. Is there a command that I can use to change it? If I go to the GUI of ubuntu, my keyboard is correct (azerty).

Thanks


Solution 1:

This should set your keyboard to azerty in a terminal emulator:

setxkbmap fr

If on a console, that would be (as root):

loadkeys fr

Solution 2:

I tried what @jlliagre suggests but the OS told me "the permission is denied" so the solution here is very easy. If you are on the console you write sudo loadkeys fr to change the keyboard mode to azerty, then you enter your session password and finally all will be right.