How do I remap the Caps Lock and Ctrl keys?How do I turn Caps Lock into an extra Control key?Is it possible...

GeometricMean definition

Is my plan for fixing my water heater leak bad?

What is the wife of a henpecked husband called?

Pronunciation of powers

What is the difference between ashamed and shamed?

Why do members of Congress in committee hearings ask witnesses the same question multiple times?

Compare four integers, return word based on maximum

How do I construct an nxn matrix?

Book where the good guy lives backwards through time and the bad guy lives forward

I am on the US no-fly list. What can I do in order to be allowed on flights which go through US airspace?

How to deny access to SQL Server to certain login over SSMS, but allow over .Net SqlClient Data Provider

As a new poet, where can I find help from a professional to judge my work?

Exponential growth/decay formula: what happened to the other constant of integration?

If nine coins are tossed, what is the probability that the number of heads is even?

Sometimes a banana is just a banana

What's the difference between a cart and a wagon?

Use comma instead of & in table

Did 5.25" floppies undergo a change in magnetic coating?

Can you 'upgrade' leather armor to studded leather armor without purchasing the new armor directly?

Hacker Rank: Array left rotation

What do the pedals on grand pianos do?

Why does the author believe that the central mass that gas cloud HCN-0.009-0.044 orbits is smaller than our solar system?

What am I? I am in theaters and computer programs

Is it 40% or 0.4%?



How do I remap the Caps Lock and Ctrl keys?


How do I turn Caps Lock into an extra Control key?Is it possible to rebind Ctrl+Alt to the Meta key?Can I map a key (caps lock) so it does one thing pressed alone, and another when pressed with a second key?After swapping Ctrl and caps in xmodmap, how can I make Ctrl work properly for multi-modifier combinations?Caps-Lock remaps to ESC doesn't desactivate the capslockingRemap dead_diaresis(?) to CtrlHow to disable caps lock on bootHow to cleanly swap alt and ctrl keys in xubuntu?How to figure out the keycode of and remap my right ctrl key?Super key stuck on Ubuntu 18.04 - can't issue commandsHow Can I Add New Modifier Key (as Shift )













65















I'd like to remap my keys such that Ctrl behaves as the Caps Lock key and vice-versa. Also, if possible I'd like the settings to be available only within the currently logged-in user. How can I achieve this?



I'm a vim user, unlike the other people who use this machine, so I'd like those settings only for my account.










share|improve this question

























  • Does This help?

    – Mitch
    May 7 '14 at 6:27











  • This may be helpful: the-flat-trantor-society.blogspot.com/2013/12/…

    – Keith Thompson
    Jan 15 '15 at 22:05






  • 3





    I'm appalled that this is not a standard feature in Linux settings in this day and age.

    – Edward Falk
    Jun 29 '15 at 23:16


















65















I'd like to remap my keys such that Ctrl behaves as the Caps Lock key and vice-versa. Also, if possible I'd like the settings to be available only within the currently logged-in user. How can I achieve this?



I'm a vim user, unlike the other people who use this machine, so I'd like those settings only for my account.










share|improve this question

























  • Does This help?

    – Mitch
    May 7 '14 at 6:27











  • This may be helpful: the-flat-trantor-society.blogspot.com/2013/12/…

    – Keith Thompson
    Jan 15 '15 at 22:05






  • 3





    I'm appalled that this is not a standard feature in Linux settings in this day and age.

    – Edward Falk
    Jun 29 '15 at 23:16
















65












65








65


36






I'd like to remap my keys such that Ctrl behaves as the Caps Lock key and vice-versa. Also, if possible I'd like the settings to be available only within the currently logged-in user. How can I achieve this?



I'm a vim user, unlike the other people who use this machine, so I'd like those settings only for my account.










share|improve this question
















I'd like to remap my keys such that Ctrl behaves as the Caps Lock key and vice-versa. Also, if possible I'd like the settings to be available only within the currently logged-in user. How can I achieve this?



I'm a vim user, unlike the other people who use this machine, so I'd like those settings only for my account.







keyboard vim






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 15 '12 at 11:26









k0pernikus

2,96963063




2,96963063










asked Apr 6 '11 at 12:01







user8838




















  • Does This help?

    – Mitch
    May 7 '14 at 6:27











  • This may be helpful: the-flat-trantor-society.blogspot.com/2013/12/…

    – Keith Thompson
    Jan 15 '15 at 22:05






  • 3





    I'm appalled that this is not a standard feature in Linux settings in this day and age.

    – Edward Falk
    Jun 29 '15 at 23:16





















  • Does This help?

    – Mitch
    May 7 '14 at 6:27











  • This may be helpful: the-flat-trantor-society.blogspot.com/2013/12/…

    – Keith Thompson
    Jan 15 '15 at 22:05






  • 3





    I'm appalled that this is not a standard feature in Linux settings in this day and age.

    – Edward Falk
    Jun 29 '15 at 23:16



















Does This help?

– Mitch
May 7 '14 at 6:27





Does This help?

– Mitch
May 7 '14 at 6:27













This may be helpful: the-flat-trantor-society.blogspot.com/2013/12/…

– Keith Thompson
Jan 15 '15 at 22:05





This may be helpful: the-flat-trantor-society.blogspot.com/2013/12/…

– Keith Thompson
Jan 15 '15 at 22:05




3




3





I'm appalled that this is not a standard feature in Linux settings in this day and age.

– Edward Falk
Jun 29 '15 at 23:16







I'm appalled that this is not a standard feature in Linux settings in this day and age.

– Edward Falk
Jun 29 '15 at 23:16












10 Answers
10






active

oldest

votes


















50














13.10+:



Install and use gnome-tweak-tool > Typing, as pointed out by @JeremyBicha in the comments to this answer.



Pre 13.10:



Open the Keyboard Preferences dialog (System -> Preferences -> Keyboard). On the layout tab, click the Options... button. Expand the Ctrl key position section and select Swap Ctrl and Caps Lock.



Those settings should be applied each time you log in, and will only affect your user account.






share|improve this answer





















  • 2





    This option has disappeared in Ubuntu Saucy. I'm not sure how to explain this but it is simply not there. The Keyboard preferences have no "Layout tab", but there is a "layout settings" button, and when I click it it takes me to the "Input Sources" tab of the "Region & Language" panel, which is mysteriously lacking any kind of 'Options' button. The only button there opens up a virtual on-screen keyboard that displays my broken keyboard layout to me with no way of changing which keys behave which way.

    – robru
    Sep 6 '13 at 18:34






  • 4





    For Ubuntu 13.10, you'll need to use gnome-tweak-tool.

    – Jeremy Bicha
    Sep 11 '13 at 15:02






  • 1





    Pre 13.10 option works for me in 14.04

    – JeremyKun
    Aug 11 '17 at 17:30











  • Same as @JeremyKun. In my case, using 14.04, the pre 13.10 solution worked but the 13.10+ didn't

    – matiascelasco
    Sep 18 '17 at 15:59











  • Thanks for this answer! The gnome-tweak-tool is really nice; you can also use it for niceties like "use Caps Lock for switching keyboard layouts" (a personal favourite) and "switch Alt/Win" (which is useful if you've been a long-time Mac user...)

    – Per Lundberg
    Jul 2 '18 at 19:27



















57














One of the best ways to do that graphically is to install Gnome Tweak Tool:



sudo apt-get install gnome-tweak-tool




  • Open tweak-tool and click on the typing section in the left column.

  • You should now see the line Caps Lock key behavior on the left.

  • Choose Make Caps Lock an additionnal Ctrl key instead of Disabled in the drop down list and you should be good.


Besides the the setting panel does not take a lot of time to come up on my machine, so I have no idea what the problem is.



Enjoy your new Ctrl key!






share|improve this answer


























  • Thanks very much for this -- restored my faith in the awesomeness that is Ubuntu.

    – John Gill
    May 8 '14 at 22:44











  • also, good to know others have a fast settings panel -- will have a look into what is up there.

    – John Gill
    May 8 '14 at 22:45











  • I wanted to use my CAPS key to turn my screen off. I set this up before in the System Settings > keyboard window, but the CAPS still toggled CapsLock state and LED. So I disabled the key with the tool you recommended (which has some display errors btw. - transparent window background), which also stopped my custom shortcut from working. After disabling, I had to set the shortcut again to have it work. It got set to the value 0xff or something like this instead of CAPS. I thought this procedure might help some future readers with similar wishes.

    – Byte Commander
    Feb 17 '15 at 13:13






  • 1





    Update: gnome-tweak-tool only works inside the gnome shell

    – Edward Falk
    Jun 29 '15 at 23:21






  • 1





    Note the option in gnome-tweak-tool to swap is under "Ctrl key position", not "Caps Lock key behavior".

    – Phil Goetz
    Jun 19 '17 at 19:38



















52














Here's a way to do it without installing extra software:



setxkbmap -layout us -option ctrl:nocaps


Source:




  • http://www.noah.org/wiki/CapsLock_Remap_Howto






share|improve this answer



















  • 3





    This doesn't survive after reboot. How can I make this permanent? I'd rather not put this in a startup script (e.g. .bashrc).

    – nic
    Aug 16 '15 at 21:12






  • 7





    @nic You need to also change the file sudo vi /etc/default/keyboard and change XKBOPTIONS="ctrl:nocaps". Run Jorge's command after that but as setxkbmap -option ctrl:nocaps such that it does not change your default keyboard layout.

    – Léo Léopold Hertz 준영
    May 15 '16 at 16:28





















39














Open the following for editing:



sudo vi /etc/default/keyboard


And edit XKBOPTIONS="ctrl:swapcaps"



Then, reconfigure:



sudo dpkg-reconfigure keyboard-configuration


or



/usr/bin/setxkbmap -option "ctrl:swapcaps"





share|improve this answer


























  • The question was "I'd like those settings only for my account." Editing /etc/default/keyboard is going to change it for everyone.

    – skierpage
    Jun 29 '15 at 2:18











  • you have 3 steps (1, 2, 3). Do you mean [(1 and 2) or 3] or [1 and (2 or 3)]?

    – jgomo3
    Apr 27 '16 at 20:30











  • Great! Ran the sudo dpkg-reconfigure keyboard-configuration and press several enters, and it worked!!! EDIT: however, after i log out and log back in, the setting went away. :(

    – Leon li
    Oct 28 '16 at 4:05





















21














To permanently change the behaviour:




  1. run dconf-editor


  2. select org.gnome.desktop.input-sources


  3. Change xkb-options to ['ctrl:nocaps'] (or add it to any existing options)



or on the command line (Warning -- this overwrites your existing settings!):



gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"





share|improve this answer


























  • This one liner can also be added to ~/.profile for portability.

    – jthetzel
    Oct 8 '15 at 12:08











  • This did not work for me on Kubuntu 16.04, even after a reboot.

    – zplizzi
    Sep 19 '16 at 2:50






  • 3





    dconf settings apply immediately and are persistent, so it makes no sense to put it in ~/.profile and there is no need for a reboot. This particular setting only applies to Gnome/Unity, not KDE that is used in Kubuntu.

    – Anton Eliasson
    Sep 30 '16 at 16:59



















4














This is an easy task once you know how to do it.



1) Check the keycode of yours key. Run this program at terminal.



xev




At this example, the terminal shows that the keycode for my k is "45".



2) Change them as you like creating this file:


gedit ~/.Xmodmap


It's contents should look like this example:



keycode 37 = Caps_Lock NoSymbol Caps_Lock

keycode 66 = Control_L NoSymbol Control_L



(Change the keycode number as needed - look at step "1")



Ilustration:


(Obs.: if I want to change my k I should use "keycode 45" as showed at step "1").



4) Logout and log back in or reboot or run this:



xmodmap ~/.Xmodmap


Hope you enjoy ;-)






share|improve this answer





















  • 1





    Note that this solution is likely to cause problems for anything but the simplest keymaps. The xmodmap compatibility in the newer xkb system is not perfect, so you're probably better off sticking to xkb if possible.

    – James Henstridge
    Apr 11 '11 at 7:59











  • @James would you like to explain how can we do that?

    – desgua
    Apr 11 '11 at 10:35











  • See the other answer to this question. The standard keyboard control panel will construct and xkb keymap from the base layout you pick plus the options you enable.

    – James Henstridge
    Apr 11 '11 at 14:47











  • @James Thank you very much. So I guess we should only play with keymaps when 'System -> Preferences -> Keyboard' doesn't have a solution for what we want, right?

    – desgua
    Apr 11 '11 at 19:57






  • 1





    Well, you can set up the same keymaps using the command line setxkbmap program. Writing new keymaps is possible, but a bit more involved than Xmodmap keycode mappings. It is a good thing that most of the option variants you'd want are already available.

    – James Henstridge
    Apr 12 '11 at 7:54



















2














This is how to do it manually (without additional tools), via XKB, which is the default keys manager for recent Ubuntus.
Modify /usr/share/X11/xkb/symbols/pc , section xkb_symbols "pc105":



//key <CAPS> {  [ Caps_Lock     ]   };
//key <LCTL> { [ Control_L ] };
key <CAPS> { [ Control_L ] };
key <LCTL> { [ Caps_Lock ] };


Login/logout or reboot. See here for more details.



Alternatively you can swap at the level of keycodes, that are emitted by those buttons. Modify /usr/share/X11/xkb/keycodes/evdev :



<CAPS> = 64; //66;
<LCTL> = 66; //64


You'll need to sudo rm -rf /var/lib/xkb/* to apply the changes.






share|improve this answer


























  • Great point about working at the level of the keycodes. On my laptops running Kubuntu Bionic, merely changing at the symbols level isn't satisfactory because pressing the physical Caps key still toggles the internal Caps state. Changing the keycodes works! BTW I extended this to three keys (Caps, Meta and RAlt) and would like to note that you actually need to write <CAPS> = *orig code of the physical key you want to act **as** CAPS* rather than <CAPS> = *orig code of the key you want physical CAPS to act **as** (I hope the distinction is clear). This distinction is needed in such cases.

    – jamadagni
    Feb 5 at 11:44



















2














The accepted answer is confusing because gnome-tweak-tools doesn't show any "typing" section.



Instead, click on "Keyboard & Mouse" section and then choose "Additional Layout Option". There, you will see "Caps Lock behavior" which allows converting caps lock to different keys.



Screenshot from tweak-tool






share|improve this answer































    1














    On KDE-based distributions (like KDE Neon or Kubuntu) this behavior can be configured in the regular system settings. Open the system settings, select "Input Devices" => "Keyboard" => "Advanced". In the category "Ctrl key position" select "Swap Ctrl and Caps Lock".



    Screenshot of KDE's System Setting's Keyboard module






    share|improve this answer































      0














      gnome-tweaks 3.28.1 has no Typing section.

      Thus, setxkbmap -layout us -option ctrl:nocaps or setxkbmap -layout us -option ctrl:swapcaps would be feasible options.



      To make it permanent, you can refer to the answer of @name.






      share|improve this answer























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "89"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f33774%2fhow-do-i-remap-the-caps-lock-and-ctrl-keys%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown
























        10 Answers
        10






        active

        oldest

        votes








        10 Answers
        10






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        50














        13.10+:



        Install and use gnome-tweak-tool > Typing, as pointed out by @JeremyBicha in the comments to this answer.



        Pre 13.10:



        Open the Keyboard Preferences dialog (System -> Preferences -> Keyboard). On the layout tab, click the Options... button. Expand the Ctrl key position section and select Swap Ctrl and Caps Lock.



        Those settings should be applied each time you log in, and will only affect your user account.






        share|improve this answer





















        • 2





          This option has disappeared in Ubuntu Saucy. I'm not sure how to explain this but it is simply not there. The Keyboard preferences have no "Layout tab", but there is a "layout settings" button, and when I click it it takes me to the "Input Sources" tab of the "Region & Language" panel, which is mysteriously lacking any kind of 'Options' button. The only button there opens up a virtual on-screen keyboard that displays my broken keyboard layout to me with no way of changing which keys behave which way.

          – robru
          Sep 6 '13 at 18:34






        • 4





          For Ubuntu 13.10, you'll need to use gnome-tweak-tool.

          – Jeremy Bicha
          Sep 11 '13 at 15:02






        • 1





          Pre 13.10 option works for me in 14.04

          – JeremyKun
          Aug 11 '17 at 17:30











        • Same as @JeremyKun. In my case, using 14.04, the pre 13.10 solution worked but the 13.10+ didn't

          – matiascelasco
          Sep 18 '17 at 15:59











        • Thanks for this answer! The gnome-tweak-tool is really nice; you can also use it for niceties like "use Caps Lock for switching keyboard layouts" (a personal favourite) and "switch Alt/Win" (which is useful if you've been a long-time Mac user...)

          – Per Lundberg
          Jul 2 '18 at 19:27
















        50














        13.10+:



        Install and use gnome-tweak-tool > Typing, as pointed out by @JeremyBicha in the comments to this answer.



        Pre 13.10:



        Open the Keyboard Preferences dialog (System -> Preferences -> Keyboard). On the layout tab, click the Options... button. Expand the Ctrl key position section and select Swap Ctrl and Caps Lock.



        Those settings should be applied each time you log in, and will only affect your user account.






        share|improve this answer





















        • 2





          This option has disappeared in Ubuntu Saucy. I'm not sure how to explain this but it is simply not there. The Keyboard preferences have no "Layout tab", but there is a "layout settings" button, and when I click it it takes me to the "Input Sources" tab of the "Region & Language" panel, which is mysteriously lacking any kind of 'Options' button. The only button there opens up a virtual on-screen keyboard that displays my broken keyboard layout to me with no way of changing which keys behave which way.

          – robru
          Sep 6 '13 at 18:34






        • 4





          For Ubuntu 13.10, you'll need to use gnome-tweak-tool.

          – Jeremy Bicha
          Sep 11 '13 at 15:02






        • 1





          Pre 13.10 option works for me in 14.04

          – JeremyKun
          Aug 11 '17 at 17:30











        • Same as @JeremyKun. In my case, using 14.04, the pre 13.10 solution worked but the 13.10+ didn't

          – matiascelasco
          Sep 18 '17 at 15:59











        • Thanks for this answer! The gnome-tweak-tool is really nice; you can also use it for niceties like "use Caps Lock for switching keyboard layouts" (a personal favourite) and "switch Alt/Win" (which is useful if you've been a long-time Mac user...)

          – Per Lundberg
          Jul 2 '18 at 19:27














        50












        50








        50







        13.10+:



        Install and use gnome-tweak-tool > Typing, as pointed out by @JeremyBicha in the comments to this answer.



        Pre 13.10:



        Open the Keyboard Preferences dialog (System -> Preferences -> Keyboard). On the layout tab, click the Options... button. Expand the Ctrl key position section and select Swap Ctrl and Caps Lock.



        Those settings should be applied each time you log in, and will only affect your user account.






        share|improve this answer















        13.10+:



        Install and use gnome-tweak-tool > Typing, as pointed out by @JeremyBicha in the comments to this answer.



        Pre 13.10:



        Open the Keyboard Preferences dialog (System -> Preferences -> Keyboard). On the layout tab, click the Options... button. Expand the Ctrl key position section and select Swap Ctrl and Caps Lock.



        Those settings should be applied each time you log in, and will only affect your user account.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Oct 23 '13 at 9:49









        decibyte

        2311414




        2311414










        answered Apr 6 '11 at 13:43









        James HenstridgeJames Henstridge

        31.5k79288




        31.5k79288








        • 2





          This option has disappeared in Ubuntu Saucy. I'm not sure how to explain this but it is simply not there. The Keyboard preferences have no "Layout tab", but there is a "layout settings" button, and when I click it it takes me to the "Input Sources" tab of the "Region & Language" panel, which is mysteriously lacking any kind of 'Options' button. The only button there opens up a virtual on-screen keyboard that displays my broken keyboard layout to me with no way of changing which keys behave which way.

          – robru
          Sep 6 '13 at 18:34






        • 4





          For Ubuntu 13.10, you'll need to use gnome-tweak-tool.

          – Jeremy Bicha
          Sep 11 '13 at 15:02






        • 1





          Pre 13.10 option works for me in 14.04

          – JeremyKun
          Aug 11 '17 at 17:30











        • Same as @JeremyKun. In my case, using 14.04, the pre 13.10 solution worked but the 13.10+ didn't

          – matiascelasco
          Sep 18 '17 at 15:59











        • Thanks for this answer! The gnome-tweak-tool is really nice; you can also use it for niceties like "use Caps Lock for switching keyboard layouts" (a personal favourite) and "switch Alt/Win" (which is useful if you've been a long-time Mac user...)

          – Per Lundberg
          Jul 2 '18 at 19:27














        • 2





          This option has disappeared in Ubuntu Saucy. I'm not sure how to explain this but it is simply not there. The Keyboard preferences have no "Layout tab", but there is a "layout settings" button, and when I click it it takes me to the "Input Sources" tab of the "Region & Language" panel, which is mysteriously lacking any kind of 'Options' button. The only button there opens up a virtual on-screen keyboard that displays my broken keyboard layout to me with no way of changing which keys behave which way.

          – robru
          Sep 6 '13 at 18:34






        • 4





          For Ubuntu 13.10, you'll need to use gnome-tweak-tool.

          – Jeremy Bicha
          Sep 11 '13 at 15:02






        • 1





          Pre 13.10 option works for me in 14.04

          – JeremyKun
          Aug 11 '17 at 17:30











        • Same as @JeremyKun. In my case, using 14.04, the pre 13.10 solution worked but the 13.10+ didn't

          – matiascelasco
          Sep 18 '17 at 15:59











        • Thanks for this answer! The gnome-tweak-tool is really nice; you can also use it for niceties like "use Caps Lock for switching keyboard layouts" (a personal favourite) and "switch Alt/Win" (which is useful if you've been a long-time Mac user...)

          – Per Lundberg
          Jul 2 '18 at 19:27








        2




        2





        This option has disappeared in Ubuntu Saucy. I'm not sure how to explain this but it is simply not there. The Keyboard preferences have no "Layout tab", but there is a "layout settings" button, and when I click it it takes me to the "Input Sources" tab of the "Region & Language" panel, which is mysteriously lacking any kind of 'Options' button. The only button there opens up a virtual on-screen keyboard that displays my broken keyboard layout to me with no way of changing which keys behave which way.

        – robru
        Sep 6 '13 at 18:34





        This option has disappeared in Ubuntu Saucy. I'm not sure how to explain this but it is simply not there. The Keyboard preferences have no "Layout tab", but there is a "layout settings" button, and when I click it it takes me to the "Input Sources" tab of the "Region & Language" panel, which is mysteriously lacking any kind of 'Options' button. The only button there opens up a virtual on-screen keyboard that displays my broken keyboard layout to me with no way of changing which keys behave which way.

        – robru
        Sep 6 '13 at 18:34




        4




        4





        For Ubuntu 13.10, you'll need to use gnome-tweak-tool.

        – Jeremy Bicha
        Sep 11 '13 at 15:02





        For Ubuntu 13.10, you'll need to use gnome-tweak-tool.

        – Jeremy Bicha
        Sep 11 '13 at 15:02




        1




        1





        Pre 13.10 option works for me in 14.04

        – JeremyKun
        Aug 11 '17 at 17:30





        Pre 13.10 option works for me in 14.04

        – JeremyKun
        Aug 11 '17 at 17:30













        Same as @JeremyKun. In my case, using 14.04, the pre 13.10 solution worked but the 13.10+ didn't

        – matiascelasco
        Sep 18 '17 at 15:59





        Same as @JeremyKun. In my case, using 14.04, the pre 13.10 solution worked but the 13.10+ didn't

        – matiascelasco
        Sep 18 '17 at 15:59













        Thanks for this answer! The gnome-tweak-tool is really nice; you can also use it for niceties like "use Caps Lock for switching keyboard layouts" (a personal favourite) and "switch Alt/Win" (which is useful if you've been a long-time Mac user...)

        – Per Lundberg
        Jul 2 '18 at 19:27





        Thanks for this answer! The gnome-tweak-tool is really nice; you can also use it for niceties like "use Caps Lock for switching keyboard layouts" (a personal favourite) and "switch Alt/Win" (which is useful if you've been a long-time Mac user...)

        – Per Lundberg
        Jul 2 '18 at 19:27













        57














        One of the best ways to do that graphically is to install Gnome Tweak Tool:



        sudo apt-get install gnome-tweak-tool




        • Open tweak-tool and click on the typing section in the left column.

        • You should now see the line Caps Lock key behavior on the left.

        • Choose Make Caps Lock an additionnal Ctrl key instead of Disabled in the drop down list and you should be good.


        Besides the the setting panel does not take a lot of time to come up on my machine, so I have no idea what the problem is.



        Enjoy your new Ctrl key!






        share|improve this answer


























        • Thanks very much for this -- restored my faith in the awesomeness that is Ubuntu.

          – John Gill
          May 8 '14 at 22:44











        • also, good to know others have a fast settings panel -- will have a look into what is up there.

          – John Gill
          May 8 '14 at 22:45











        • I wanted to use my CAPS key to turn my screen off. I set this up before in the System Settings > keyboard window, but the CAPS still toggled CapsLock state and LED. So I disabled the key with the tool you recommended (which has some display errors btw. - transparent window background), which also stopped my custom shortcut from working. After disabling, I had to set the shortcut again to have it work. It got set to the value 0xff or something like this instead of CAPS. I thought this procedure might help some future readers with similar wishes.

          – Byte Commander
          Feb 17 '15 at 13:13






        • 1





          Update: gnome-tweak-tool only works inside the gnome shell

          – Edward Falk
          Jun 29 '15 at 23:21






        • 1





          Note the option in gnome-tweak-tool to swap is under "Ctrl key position", not "Caps Lock key behavior".

          – Phil Goetz
          Jun 19 '17 at 19:38
















        57














        One of the best ways to do that graphically is to install Gnome Tweak Tool:



        sudo apt-get install gnome-tweak-tool




        • Open tweak-tool and click on the typing section in the left column.

        • You should now see the line Caps Lock key behavior on the left.

        • Choose Make Caps Lock an additionnal Ctrl key instead of Disabled in the drop down list and you should be good.


        Besides the the setting panel does not take a lot of time to come up on my machine, so I have no idea what the problem is.



        Enjoy your new Ctrl key!






        share|improve this answer


























        • Thanks very much for this -- restored my faith in the awesomeness that is Ubuntu.

          – John Gill
          May 8 '14 at 22:44











        • also, good to know others have a fast settings panel -- will have a look into what is up there.

          – John Gill
          May 8 '14 at 22:45











        • I wanted to use my CAPS key to turn my screen off. I set this up before in the System Settings > keyboard window, but the CAPS still toggled CapsLock state and LED. So I disabled the key with the tool you recommended (which has some display errors btw. - transparent window background), which also stopped my custom shortcut from working. After disabling, I had to set the shortcut again to have it work. It got set to the value 0xff or something like this instead of CAPS. I thought this procedure might help some future readers with similar wishes.

          – Byte Commander
          Feb 17 '15 at 13:13






        • 1





          Update: gnome-tweak-tool only works inside the gnome shell

          – Edward Falk
          Jun 29 '15 at 23:21






        • 1





          Note the option in gnome-tweak-tool to swap is under "Ctrl key position", not "Caps Lock key behavior".

          – Phil Goetz
          Jun 19 '17 at 19:38














        57












        57








        57







        One of the best ways to do that graphically is to install Gnome Tweak Tool:



        sudo apt-get install gnome-tweak-tool




        • Open tweak-tool and click on the typing section in the left column.

        • You should now see the line Caps Lock key behavior on the left.

        • Choose Make Caps Lock an additionnal Ctrl key instead of Disabled in the drop down list and you should be good.


        Besides the the setting panel does not take a lot of time to come up on my machine, so I have no idea what the problem is.



        Enjoy your new Ctrl key!






        share|improve this answer















        One of the best ways to do that graphically is to install Gnome Tweak Tool:



        sudo apt-get install gnome-tweak-tool




        • Open tweak-tool and click on the typing section in the left column.

        • You should now see the line Caps Lock key behavior on the left.

        • Choose Make Caps Lock an additionnal Ctrl key instead of Disabled in the drop down list and you should be good.


        Besides the the setting panel does not take a lot of time to come up on my machine, so I have no idea what the problem is.



        Enjoy your new Ctrl key!







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 24 '17 at 22:04

























        answered May 7 '14 at 18:57









        Pierre ThalamyPierre Thalamy

        67056




        67056













        • Thanks very much for this -- restored my faith in the awesomeness that is Ubuntu.

          – John Gill
          May 8 '14 at 22:44











        • also, good to know others have a fast settings panel -- will have a look into what is up there.

          – John Gill
          May 8 '14 at 22:45











        • I wanted to use my CAPS key to turn my screen off. I set this up before in the System Settings > keyboard window, but the CAPS still toggled CapsLock state and LED. So I disabled the key with the tool you recommended (which has some display errors btw. - transparent window background), which also stopped my custom shortcut from working. After disabling, I had to set the shortcut again to have it work. It got set to the value 0xff or something like this instead of CAPS. I thought this procedure might help some future readers with similar wishes.

          – Byte Commander
          Feb 17 '15 at 13:13






        • 1





          Update: gnome-tweak-tool only works inside the gnome shell

          – Edward Falk
          Jun 29 '15 at 23:21






        • 1





          Note the option in gnome-tweak-tool to swap is under "Ctrl key position", not "Caps Lock key behavior".

          – Phil Goetz
          Jun 19 '17 at 19:38



















        • Thanks very much for this -- restored my faith in the awesomeness that is Ubuntu.

          – John Gill
          May 8 '14 at 22:44











        • also, good to know others have a fast settings panel -- will have a look into what is up there.

          – John Gill
          May 8 '14 at 22:45











        • I wanted to use my CAPS key to turn my screen off. I set this up before in the System Settings > keyboard window, but the CAPS still toggled CapsLock state and LED. So I disabled the key with the tool you recommended (which has some display errors btw. - transparent window background), which also stopped my custom shortcut from working. After disabling, I had to set the shortcut again to have it work. It got set to the value 0xff or something like this instead of CAPS. I thought this procedure might help some future readers with similar wishes.

          – Byte Commander
          Feb 17 '15 at 13:13






        • 1





          Update: gnome-tweak-tool only works inside the gnome shell

          – Edward Falk
          Jun 29 '15 at 23:21






        • 1





          Note the option in gnome-tweak-tool to swap is under "Ctrl key position", not "Caps Lock key behavior".

          – Phil Goetz
          Jun 19 '17 at 19:38

















        Thanks very much for this -- restored my faith in the awesomeness that is Ubuntu.

        – John Gill
        May 8 '14 at 22:44





        Thanks very much for this -- restored my faith in the awesomeness that is Ubuntu.

        – John Gill
        May 8 '14 at 22:44













        also, good to know others have a fast settings panel -- will have a look into what is up there.

        – John Gill
        May 8 '14 at 22:45





        also, good to know others have a fast settings panel -- will have a look into what is up there.

        – John Gill
        May 8 '14 at 22:45













        I wanted to use my CAPS key to turn my screen off. I set this up before in the System Settings > keyboard window, but the CAPS still toggled CapsLock state and LED. So I disabled the key with the tool you recommended (which has some display errors btw. - transparent window background), which also stopped my custom shortcut from working. After disabling, I had to set the shortcut again to have it work. It got set to the value 0xff or something like this instead of CAPS. I thought this procedure might help some future readers with similar wishes.

        – Byte Commander
        Feb 17 '15 at 13:13





        I wanted to use my CAPS key to turn my screen off. I set this up before in the System Settings > keyboard window, but the CAPS still toggled CapsLock state and LED. So I disabled the key with the tool you recommended (which has some display errors btw. - transparent window background), which also stopped my custom shortcut from working. After disabling, I had to set the shortcut again to have it work. It got set to the value 0xff or something like this instead of CAPS. I thought this procedure might help some future readers with similar wishes.

        – Byte Commander
        Feb 17 '15 at 13:13




        1




        1





        Update: gnome-tweak-tool only works inside the gnome shell

        – Edward Falk
        Jun 29 '15 at 23:21





        Update: gnome-tweak-tool only works inside the gnome shell

        – Edward Falk
        Jun 29 '15 at 23:21




        1




        1





        Note the option in gnome-tweak-tool to swap is under "Ctrl key position", not "Caps Lock key behavior".

        – Phil Goetz
        Jun 19 '17 at 19:38





        Note the option in gnome-tweak-tool to swap is under "Ctrl key position", not "Caps Lock key behavior".

        – Phil Goetz
        Jun 19 '17 at 19:38











        52














        Here's a way to do it without installing extra software:



        setxkbmap -layout us -option ctrl:nocaps


        Source:




        • http://www.noah.org/wiki/CapsLock_Remap_Howto






        share|improve this answer



















        • 3





          This doesn't survive after reboot. How can I make this permanent? I'd rather not put this in a startup script (e.g. .bashrc).

          – nic
          Aug 16 '15 at 21:12






        • 7





          @nic You need to also change the file sudo vi /etc/default/keyboard and change XKBOPTIONS="ctrl:nocaps". Run Jorge's command after that but as setxkbmap -option ctrl:nocaps such that it does not change your default keyboard layout.

          – Léo Léopold Hertz 준영
          May 15 '16 at 16:28


















        52














        Here's a way to do it without installing extra software:



        setxkbmap -layout us -option ctrl:nocaps


        Source:




        • http://www.noah.org/wiki/CapsLock_Remap_Howto






        share|improve this answer



















        • 3





          This doesn't survive after reboot. How can I make this permanent? I'd rather not put this in a startup script (e.g. .bashrc).

          – nic
          Aug 16 '15 at 21:12






        • 7





          @nic You need to also change the file sudo vi /etc/default/keyboard and change XKBOPTIONS="ctrl:nocaps". Run Jorge's command after that but as setxkbmap -option ctrl:nocaps such that it does not change your default keyboard layout.

          – Léo Léopold Hertz 준영
          May 15 '16 at 16:28
















        52












        52








        52







        Here's a way to do it without installing extra software:



        setxkbmap -layout us -option ctrl:nocaps


        Source:




        • http://www.noah.org/wiki/CapsLock_Remap_Howto






        share|improve this answer













        Here's a way to do it without installing extra software:



        setxkbmap -layout us -option ctrl:nocaps


        Source:




        • http://www.noah.org/wiki/CapsLock_Remap_Howto







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 9 '14 at 1:05









        Jorge CastroJorge Castro

        36.8k106422617




        36.8k106422617








        • 3





          This doesn't survive after reboot. How can I make this permanent? I'd rather not put this in a startup script (e.g. .bashrc).

          – nic
          Aug 16 '15 at 21:12






        • 7





          @nic You need to also change the file sudo vi /etc/default/keyboard and change XKBOPTIONS="ctrl:nocaps". Run Jorge's command after that but as setxkbmap -option ctrl:nocaps such that it does not change your default keyboard layout.

          – Léo Léopold Hertz 준영
          May 15 '16 at 16:28
















        • 3





          This doesn't survive after reboot. How can I make this permanent? I'd rather not put this in a startup script (e.g. .bashrc).

          – nic
          Aug 16 '15 at 21:12






        • 7





          @nic You need to also change the file sudo vi /etc/default/keyboard and change XKBOPTIONS="ctrl:nocaps". Run Jorge's command after that but as setxkbmap -option ctrl:nocaps such that it does not change your default keyboard layout.

          – Léo Léopold Hertz 준영
          May 15 '16 at 16:28










        3




        3





        This doesn't survive after reboot. How can I make this permanent? I'd rather not put this in a startup script (e.g. .bashrc).

        – nic
        Aug 16 '15 at 21:12





        This doesn't survive after reboot. How can I make this permanent? I'd rather not put this in a startup script (e.g. .bashrc).

        – nic
        Aug 16 '15 at 21:12




        7




        7





        @nic You need to also change the file sudo vi /etc/default/keyboard and change XKBOPTIONS="ctrl:nocaps". Run Jorge's command after that but as setxkbmap -option ctrl:nocaps such that it does not change your default keyboard layout.

        – Léo Léopold Hertz 준영
        May 15 '16 at 16:28







        @nic You need to also change the file sudo vi /etc/default/keyboard and change XKBOPTIONS="ctrl:nocaps". Run Jorge's command after that but as setxkbmap -option ctrl:nocaps such that it does not change your default keyboard layout.

        – Léo Léopold Hertz 준영
        May 15 '16 at 16:28













        39














        Open the following for editing:



        sudo vi /etc/default/keyboard


        And edit XKBOPTIONS="ctrl:swapcaps"



        Then, reconfigure:



        sudo dpkg-reconfigure keyboard-configuration


        or



        /usr/bin/setxkbmap -option "ctrl:swapcaps"





        share|improve this answer


























        • The question was "I'd like those settings only for my account." Editing /etc/default/keyboard is going to change it for everyone.

          – skierpage
          Jun 29 '15 at 2:18











        • you have 3 steps (1, 2, 3). Do you mean [(1 and 2) or 3] or [1 and (2 or 3)]?

          – jgomo3
          Apr 27 '16 at 20:30











        • Great! Ran the sudo dpkg-reconfigure keyboard-configuration and press several enters, and it worked!!! EDIT: however, after i log out and log back in, the setting went away. :(

          – Leon li
          Oct 28 '16 at 4:05


















        39














        Open the following for editing:



        sudo vi /etc/default/keyboard


        And edit XKBOPTIONS="ctrl:swapcaps"



        Then, reconfigure:



        sudo dpkg-reconfigure keyboard-configuration


        or



        /usr/bin/setxkbmap -option "ctrl:swapcaps"





        share|improve this answer


























        • The question was "I'd like those settings only for my account." Editing /etc/default/keyboard is going to change it for everyone.

          – skierpage
          Jun 29 '15 at 2:18











        • you have 3 steps (1, 2, 3). Do you mean [(1 and 2) or 3] or [1 and (2 or 3)]?

          – jgomo3
          Apr 27 '16 at 20:30











        • Great! Ran the sudo dpkg-reconfigure keyboard-configuration and press several enters, and it worked!!! EDIT: however, after i log out and log back in, the setting went away. :(

          – Leon li
          Oct 28 '16 at 4:05
















        39












        39








        39







        Open the following for editing:



        sudo vi /etc/default/keyboard


        And edit XKBOPTIONS="ctrl:swapcaps"



        Then, reconfigure:



        sudo dpkg-reconfigure keyboard-configuration


        or



        /usr/bin/setxkbmap -option "ctrl:swapcaps"





        share|improve this answer















        Open the following for editing:



        sudo vi /etc/default/keyboard


        And edit XKBOPTIONS="ctrl:swapcaps"



        Then, reconfigure:



        sudo dpkg-reconfigure keyboard-configuration


        or



        /usr/bin/setxkbmap -option "ctrl:swapcaps"






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 10 '14 at 1:18









        amc

        4,75462746




        4,75462746










        answered Feb 10 '14 at 0:58









        namename

        49142




        49142













        • The question was "I'd like those settings only for my account." Editing /etc/default/keyboard is going to change it for everyone.

          – skierpage
          Jun 29 '15 at 2:18











        • you have 3 steps (1, 2, 3). Do you mean [(1 and 2) or 3] or [1 and (2 or 3)]?

          – jgomo3
          Apr 27 '16 at 20:30











        • Great! Ran the sudo dpkg-reconfigure keyboard-configuration and press several enters, and it worked!!! EDIT: however, after i log out and log back in, the setting went away. :(

          – Leon li
          Oct 28 '16 at 4:05





















        • The question was "I'd like those settings only for my account." Editing /etc/default/keyboard is going to change it for everyone.

          – skierpage
          Jun 29 '15 at 2:18











        • you have 3 steps (1, 2, 3). Do you mean [(1 and 2) or 3] or [1 and (2 or 3)]?

          – jgomo3
          Apr 27 '16 at 20:30











        • Great! Ran the sudo dpkg-reconfigure keyboard-configuration and press several enters, and it worked!!! EDIT: however, after i log out and log back in, the setting went away. :(

          – Leon li
          Oct 28 '16 at 4:05



















        The question was "I'd like those settings only for my account." Editing /etc/default/keyboard is going to change it for everyone.

        – skierpage
        Jun 29 '15 at 2:18





        The question was "I'd like those settings only for my account." Editing /etc/default/keyboard is going to change it for everyone.

        – skierpage
        Jun 29 '15 at 2:18













        you have 3 steps (1, 2, 3). Do you mean [(1 and 2) or 3] or [1 and (2 or 3)]?

        – jgomo3
        Apr 27 '16 at 20:30





        you have 3 steps (1, 2, 3). Do you mean [(1 and 2) or 3] or [1 and (2 or 3)]?

        – jgomo3
        Apr 27 '16 at 20:30













        Great! Ran the sudo dpkg-reconfigure keyboard-configuration and press several enters, and it worked!!! EDIT: however, after i log out and log back in, the setting went away. :(

        – Leon li
        Oct 28 '16 at 4:05







        Great! Ran the sudo dpkg-reconfigure keyboard-configuration and press several enters, and it worked!!! EDIT: however, after i log out and log back in, the setting went away. :(

        – Leon li
        Oct 28 '16 at 4:05













        21














        To permanently change the behaviour:




        1. run dconf-editor


        2. select org.gnome.desktop.input-sources


        3. Change xkb-options to ['ctrl:nocaps'] (or add it to any existing options)



        or on the command line (Warning -- this overwrites your existing settings!):



        gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"





        share|improve this answer


























        • This one liner can also be added to ~/.profile for portability.

          – jthetzel
          Oct 8 '15 at 12:08











        • This did not work for me on Kubuntu 16.04, even after a reboot.

          – zplizzi
          Sep 19 '16 at 2:50






        • 3





          dconf settings apply immediately and are persistent, so it makes no sense to put it in ~/.profile and there is no need for a reboot. This particular setting only applies to Gnome/Unity, not KDE that is used in Kubuntu.

          – Anton Eliasson
          Sep 30 '16 at 16:59
















        21














        To permanently change the behaviour:




        1. run dconf-editor


        2. select org.gnome.desktop.input-sources


        3. Change xkb-options to ['ctrl:nocaps'] (or add it to any existing options)



        or on the command line (Warning -- this overwrites your existing settings!):



        gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"





        share|improve this answer


























        • This one liner can also be added to ~/.profile for portability.

          – jthetzel
          Oct 8 '15 at 12:08











        • This did not work for me on Kubuntu 16.04, even after a reboot.

          – zplizzi
          Sep 19 '16 at 2:50






        • 3





          dconf settings apply immediately and are persistent, so it makes no sense to put it in ~/.profile and there is no need for a reboot. This particular setting only applies to Gnome/Unity, not KDE that is used in Kubuntu.

          – Anton Eliasson
          Sep 30 '16 at 16:59














        21












        21








        21







        To permanently change the behaviour:




        1. run dconf-editor


        2. select org.gnome.desktop.input-sources


        3. Change xkb-options to ['ctrl:nocaps'] (or add it to any existing options)



        or on the command line (Warning -- this overwrites your existing settings!):



        gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"





        share|improve this answer















        To permanently change the behaviour:




        1. run dconf-editor


        2. select org.gnome.desktop.input-sources


        3. Change xkb-options to ['ctrl:nocaps'] (or add it to any existing options)



        or on the command line (Warning -- this overwrites your existing settings!):



        gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Aug 24 '16 at 18:59









        David Foerster

        28.4k1366111




        28.4k1366111










        answered Jun 7 '15 at 21:58









        Geoff JacobsenGeoff Jacobsen

        21122




        21122













        • This one liner can also be added to ~/.profile for portability.

          – jthetzel
          Oct 8 '15 at 12:08











        • This did not work for me on Kubuntu 16.04, even after a reboot.

          – zplizzi
          Sep 19 '16 at 2:50






        • 3





          dconf settings apply immediately and are persistent, so it makes no sense to put it in ~/.profile and there is no need for a reboot. This particular setting only applies to Gnome/Unity, not KDE that is used in Kubuntu.

          – Anton Eliasson
          Sep 30 '16 at 16:59



















        • This one liner can also be added to ~/.profile for portability.

          – jthetzel
          Oct 8 '15 at 12:08











        • This did not work for me on Kubuntu 16.04, even after a reboot.

          – zplizzi
          Sep 19 '16 at 2:50






        • 3





          dconf settings apply immediately and are persistent, so it makes no sense to put it in ~/.profile and there is no need for a reboot. This particular setting only applies to Gnome/Unity, not KDE that is used in Kubuntu.

          – Anton Eliasson
          Sep 30 '16 at 16:59

















        This one liner can also be added to ~/.profile for portability.

        – jthetzel
        Oct 8 '15 at 12:08





        This one liner can also be added to ~/.profile for portability.

        – jthetzel
        Oct 8 '15 at 12:08













        This did not work for me on Kubuntu 16.04, even after a reboot.

        – zplizzi
        Sep 19 '16 at 2:50





        This did not work for me on Kubuntu 16.04, even after a reboot.

        – zplizzi
        Sep 19 '16 at 2:50




        3




        3





        dconf settings apply immediately and are persistent, so it makes no sense to put it in ~/.profile and there is no need for a reboot. This particular setting only applies to Gnome/Unity, not KDE that is used in Kubuntu.

        – Anton Eliasson
        Sep 30 '16 at 16:59





        dconf settings apply immediately and are persistent, so it makes no sense to put it in ~/.profile and there is no need for a reboot. This particular setting only applies to Gnome/Unity, not KDE that is used in Kubuntu.

        – Anton Eliasson
        Sep 30 '16 at 16:59











        4














        This is an easy task once you know how to do it.



        1) Check the keycode of yours key. Run this program at terminal.



        xev




        At this example, the terminal shows that the keycode for my k is "45".



        2) Change them as you like creating this file:


        gedit ~/.Xmodmap


        It's contents should look like this example:



        keycode 37 = Caps_Lock NoSymbol Caps_Lock

        keycode 66 = Control_L NoSymbol Control_L



        (Change the keycode number as needed - look at step "1")



        Ilustration:


        (Obs.: if I want to change my k I should use "keycode 45" as showed at step "1").



        4) Logout and log back in or reboot or run this:



        xmodmap ~/.Xmodmap


        Hope you enjoy ;-)






        share|improve this answer





















        • 1





          Note that this solution is likely to cause problems for anything but the simplest keymaps. The xmodmap compatibility in the newer xkb system is not perfect, so you're probably better off sticking to xkb if possible.

          – James Henstridge
          Apr 11 '11 at 7:59











        • @James would you like to explain how can we do that?

          – desgua
          Apr 11 '11 at 10:35











        • See the other answer to this question. The standard keyboard control panel will construct and xkb keymap from the base layout you pick plus the options you enable.

          – James Henstridge
          Apr 11 '11 at 14:47











        • @James Thank you very much. So I guess we should only play with keymaps when 'System -> Preferences -> Keyboard' doesn't have a solution for what we want, right?

          – desgua
          Apr 11 '11 at 19:57






        • 1





          Well, you can set up the same keymaps using the command line setxkbmap program. Writing new keymaps is possible, but a bit more involved than Xmodmap keycode mappings. It is a good thing that most of the option variants you'd want are already available.

          – James Henstridge
          Apr 12 '11 at 7:54
















        4














        This is an easy task once you know how to do it.



        1) Check the keycode of yours key. Run this program at terminal.



        xev




        At this example, the terminal shows that the keycode for my k is "45".



        2) Change them as you like creating this file:


        gedit ~/.Xmodmap


        It's contents should look like this example:



        keycode 37 = Caps_Lock NoSymbol Caps_Lock

        keycode 66 = Control_L NoSymbol Control_L



        (Change the keycode number as needed - look at step "1")



        Ilustration:


        (Obs.: if I want to change my k I should use "keycode 45" as showed at step "1").



        4) Logout and log back in or reboot or run this:



        xmodmap ~/.Xmodmap


        Hope you enjoy ;-)






        share|improve this answer





















        • 1





          Note that this solution is likely to cause problems for anything but the simplest keymaps. The xmodmap compatibility in the newer xkb system is not perfect, so you're probably better off sticking to xkb if possible.

          – James Henstridge
          Apr 11 '11 at 7:59











        • @James would you like to explain how can we do that?

          – desgua
          Apr 11 '11 at 10:35











        • See the other answer to this question. The standard keyboard control panel will construct and xkb keymap from the base layout you pick plus the options you enable.

          – James Henstridge
          Apr 11 '11 at 14:47











        • @James Thank you very much. So I guess we should only play with keymaps when 'System -> Preferences -> Keyboard' doesn't have a solution for what we want, right?

          – desgua
          Apr 11 '11 at 19:57






        • 1





          Well, you can set up the same keymaps using the command line setxkbmap program. Writing new keymaps is possible, but a bit more involved than Xmodmap keycode mappings. It is a good thing that most of the option variants you'd want are already available.

          – James Henstridge
          Apr 12 '11 at 7:54














        4












        4








        4







        This is an easy task once you know how to do it.



        1) Check the keycode of yours key. Run this program at terminal.



        xev




        At this example, the terminal shows that the keycode for my k is "45".



        2) Change them as you like creating this file:


        gedit ~/.Xmodmap


        It's contents should look like this example:



        keycode 37 = Caps_Lock NoSymbol Caps_Lock

        keycode 66 = Control_L NoSymbol Control_L



        (Change the keycode number as needed - look at step "1")



        Ilustration:


        (Obs.: if I want to change my k I should use "keycode 45" as showed at step "1").



        4) Logout and log back in or reboot or run this:



        xmodmap ~/.Xmodmap


        Hope you enjoy ;-)






        share|improve this answer















        This is an easy task once you know how to do it.



        1) Check the keycode of yours key. Run this program at terminal.



        xev




        At this example, the terminal shows that the keycode for my k is "45".



        2) Change them as you like creating this file:


        gedit ~/.Xmodmap


        It's contents should look like this example:



        keycode 37 = Caps_Lock NoSymbol Caps_Lock

        keycode 66 = Control_L NoSymbol Control_L



        (Change the keycode number as needed - look at step "1")



        Ilustration:


        (Obs.: if I want to change my k I should use "keycode 45" as showed at step "1").



        4) Logout and log back in or reboot or run this:



        xmodmap ~/.Xmodmap


        Hope you enjoy ;-)







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 9 '17 at 18:04









        Community

        1




        1










        answered Apr 6 '11 at 13:24









        desguadesgua

        27.7k882112




        27.7k882112








        • 1





          Note that this solution is likely to cause problems for anything but the simplest keymaps. The xmodmap compatibility in the newer xkb system is not perfect, so you're probably better off sticking to xkb if possible.

          – James Henstridge
          Apr 11 '11 at 7:59











        • @James would you like to explain how can we do that?

          – desgua
          Apr 11 '11 at 10:35











        • See the other answer to this question. The standard keyboard control panel will construct and xkb keymap from the base layout you pick plus the options you enable.

          – James Henstridge
          Apr 11 '11 at 14:47











        • @James Thank you very much. So I guess we should only play with keymaps when 'System -> Preferences -> Keyboard' doesn't have a solution for what we want, right?

          – desgua
          Apr 11 '11 at 19:57






        • 1





          Well, you can set up the same keymaps using the command line setxkbmap program. Writing new keymaps is possible, but a bit more involved than Xmodmap keycode mappings. It is a good thing that most of the option variants you'd want are already available.

          – James Henstridge
          Apr 12 '11 at 7:54














        • 1





          Note that this solution is likely to cause problems for anything but the simplest keymaps. The xmodmap compatibility in the newer xkb system is not perfect, so you're probably better off sticking to xkb if possible.

          – James Henstridge
          Apr 11 '11 at 7:59











        • @James would you like to explain how can we do that?

          – desgua
          Apr 11 '11 at 10:35











        • See the other answer to this question. The standard keyboard control panel will construct and xkb keymap from the base layout you pick plus the options you enable.

          – James Henstridge
          Apr 11 '11 at 14:47











        • @James Thank you very much. So I guess we should only play with keymaps when 'System -> Preferences -> Keyboard' doesn't have a solution for what we want, right?

          – desgua
          Apr 11 '11 at 19:57






        • 1





          Well, you can set up the same keymaps using the command line setxkbmap program. Writing new keymaps is possible, but a bit more involved than Xmodmap keycode mappings. It is a good thing that most of the option variants you'd want are already available.

          – James Henstridge
          Apr 12 '11 at 7:54








        1




        1





        Note that this solution is likely to cause problems for anything but the simplest keymaps. The xmodmap compatibility in the newer xkb system is not perfect, so you're probably better off sticking to xkb if possible.

        – James Henstridge
        Apr 11 '11 at 7:59





        Note that this solution is likely to cause problems for anything but the simplest keymaps. The xmodmap compatibility in the newer xkb system is not perfect, so you're probably better off sticking to xkb if possible.

        – James Henstridge
        Apr 11 '11 at 7:59













        @James would you like to explain how can we do that?

        – desgua
        Apr 11 '11 at 10:35





        @James would you like to explain how can we do that?

        – desgua
        Apr 11 '11 at 10:35













        See the other answer to this question. The standard keyboard control panel will construct and xkb keymap from the base layout you pick plus the options you enable.

        – James Henstridge
        Apr 11 '11 at 14:47





        See the other answer to this question. The standard keyboard control panel will construct and xkb keymap from the base layout you pick plus the options you enable.

        – James Henstridge
        Apr 11 '11 at 14:47













        @James Thank you very much. So I guess we should only play with keymaps when 'System -> Preferences -> Keyboard' doesn't have a solution for what we want, right?

        – desgua
        Apr 11 '11 at 19:57





        @James Thank you very much. So I guess we should only play with keymaps when 'System -> Preferences -> Keyboard' doesn't have a solution for what we want, right?

        – desgua
        Apr 11 '11 at 19:57




        1




        1





        Well, you can set up the same keymaps using the command line setxkbmap program. Writing new keymaps is possible, but a bit more involved than Xmodmap keycode mappings. It is a good thing that most of the option variants you'd want are already available.

        – James Henstridge
        Apr 12 '11 at 7:54





        Well, you can set up the same keymaps using the command line setxkbmap program. Writing new keymaps is possible, but a bit more involved than Xmodmap keycode mappings. It is a good thing that most of the option variants you'd want are already available.

        – James Henstridge
        Apr 12 '11 at 7:54











        2














        This is how to do it manually (without additional tools), via XKB, which is the default keys manager for recent Ubuntus.
        Modify /usr/share/X11/xkb/symbols/pc , section xkb_symbols "pc105":



        //key <CAPS> {  [ Caps_Lock     ]   };
        //key <LCTL> { [ Control_L ] };
        key <CAPS> { [ Control_L ] };
        key <LCTL> { [ Caps_Lock ] };


        Login/logout or reboot. See here for more details.



        Alternatively you can swap at the level of keycodes, that are emitted by those buttons. Modify /usr/share/X11/xkb/keycodes/evdev :



        <CAPS> = 64; //66;
        <LCTL> = 66; //64


        You'll need to sudo rm -rf /var/lib/xkb/* to apply the changes.






        share|improve this answer


























        • Great point about working at the level of the keycodes. On my laptops running Kubuntu Bionic, merely changing at the symbols level isn't satisfactory because pressing the physical Caps key still toggles the internal Caps state. Changing the keycodes works! BTW I extended this to three keys (Caps, Meta and RAlt) and would like to note that you actually need to write <CAPS> = *orig code of the physical key you want to act **as** CAPS* rather than <CAPS> = *orig code of the key you want physical CAPS to act **as** (I hope the distinction is clear). This distinction is needed in such cases.

          – jamadagni
          Feb 5 at 11:44
















        2














        This is how to do it manually (without additional tools), via XKB, which is the default keys manager for recent Ubuntus.
        Modify /usr/share/X11/xkb/symbols/pc , section xkb_symbols "pc105":



        //key <CAPS> {  [ Caps_Lock     ]   };
        //key <LCTL> { [ Control_L ] };
        key <CAPS> { [ Control_L ] };
        key <LCTL> { [ Caps_Lock ] };


        Login/logout or reboot. See here for more details.



        Alternatively you can swap at the level of keycodes, that are emitted by those buttons. Modify /usr/share/X11/xkb/keycodes/evdev :



        <CAPS> = 64; //66;
        <LCTL> = 66; //64


        You'll need to sudo rm -rf /var/lib/xkb/* to apply the changes.






        share|improve this answer


























        • Great point about working at the level of the keycodes. On my laptops running Kubuntu Bionic, merely changing at the symbols level isn't satisfactory because pressing the physical Caps key still toggles the internal Caps state. Changing the keycodes works! BTW I extended this to three keys (Caps, Meta and RAlt) and would like to note that you actually need to write <CAPS> = *orig code of the physical key you want to act **as** CAPS* rather than <CAPS> = *orig code of the key you want physical CAPS to act **as** (I hope the distinction is clear). This distinction is needed in such cases.

          – jamadagni
          Feb 5 at 11:44














        2












        2








        2







        This is how to do it manually (without additional tools), via XKB, which is the default keys manager for recent Ubuntus.
        Modify /usr/share/X11/xkb/symbols/pc , section xkb_symbols "pc105":



        //key <CAPS> {  [ Caps_Lock     ]   };
        //key <LCTL> { [ Control_L ] };
        key <CAPS> { [ Control_L ] };
        key <LCTL> { [ Caps_Lock ] };


        Login/logout or reboot. See here for more details.



        Alternatively you can swap at the level of keycodes, that are emitted by those buttons. Modify /usr/share/X11/xkb/keycodes/evdev :



        <CAPS> = 64; //66;
        <LCTL> = 66; //64


        You'll need to sudo rm -rf /var/lib/xkb/* to apply the changes.






        share|improve this answer















        This is how to do it manually (without additional tools), via XKB, which is the default keys manager for recent Ubuntus.
        Modify /usr/share/X11/xkb/symbols/pc , section xkb_symbols "pc105":



        //key <CAPS> {  [ Caps_Lock     ]   };
        //key <LCTL> { [ Control_L ] };
        key <CAPS> { [ Control_L ] };
        key <LCTL> { [ Caps_Lock ] };


        Login/logout or reboot. See here for more details.



        Alternatively you can swap at the level of keycodes, that are emitted by those buttons. Modify /usr/share/X11/xkb/keycodes/evdev :



        <CAPS> = 64; //66;
        <LCTL> = 66; //64


        You'll need to sudo rm -rf /var/lib/xkb/* to apply the changes.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 14 '18 at 10:01

























        answered Feb 14 '18 at 9:48









        Alex FedulovAlex Fedulov

        1464




        1464













        • Great point about working at the level of the keycodes. On my laptops running Kubuntu Bionic, merely changing at the symbols level isn't satisfactory because pressing the physical Caps key still toggles the internal Caps state. Changing the keycodes works! BTW I extended this to three keys (Caps, Meta and RAlt) and would like to note that you actually need to write <CAPS> = *orig code of the physical key you want to act **as** CAPS* rather than <CAPS> = *orig code of the key you want physical CAPS to act **as** (I hope the distinction is clear). This distinction is needed in such cases.

          – jamadagni
          Feb 5 at 11:44



















        • Great point about working at the level of the keycodes. On my laptops running Kubuntu Bionic, merely changing at the symbols level isn't satisfactory because pressing the physical Caps key still toggles the internal Caps state. Changing the keycodes works! BTW I extended this to three keys (Caps, Meta and RAlt) and would like to note that you actually need to write <CAPS> = *orig code of the physical key you want to act **as** CAPS* rather than <CAPS> = *orig code of the key you want physical CAPS to act **as** (I hope the distinction is clear). This distinction is needed in such cases.

          – jamadagni
          Feb 5 at 11:44

















        Great point about working at the level of the keycodes. On my laptops running Kubuntu Bionic, merely changing at the symbols level isn't satisfactory because pressing the physical Caps key still toggles the internal Caps state. Changing the keycodes works! BTW I extended this to three keys (Caps, Meta and RAlt) and would like to note that you actually need to write <CAPS> = *orig code of the physical key you want to act **as** CAPS* rather than <CAPS> = *orig code of the key you want physical CAPS to act **as** (I hope the distinction is clear). This distinction is needed in such cases.

        – jamadagni
        Feb 5 at 11:44





        Great point about working at the level of the keycodes. On my laptops running Kubuntu Bionic, merely changing at the symbols level isn't satisfactory because pressing the physical Caps key still toggles the internal Caps state. Changing the keycodes works! BTW I extended this to three keys (Caps, Meta and RAlt) and would like to note that you actually need to write <CAPS> = *orig code of the physical key you want to act **as** CAPS* rather than <CAPS> = *orig code of the key you want physical CAPS to act **as** (I hope the distinction is clear). This distinction is needed in such cases.

        – jamadagni
        Feb 5 at 11:44











        2














        The accepted answer is confusing because gnome-tweak-tools doesn't show any "typing" section.



        Instead, click on "Keyboard & Mouse" section and then choose "Additional Layout Option". There, you will see "Caps Lock behavior" which allows converting caps lock to different keys.



        Screenshot from tweak-tool






        share|improve this answer




























          2














          The accepted answer is confusing because gnome-tweak-tools doesn't show any "typing" section.



          Instead, click on "Keyboard & Mouse" section and then choose "Additional Layout Option". There, you will see "Caps Lock behavior" which allows converting caps lock to different keys.



          Screenshot from tweak-tool






          share|improve this answer


























            2












            2








            2







            The accepted answer is confusing because gnome-tweak-tools doesn't show any "typing" section.



            Instead, click on "Keyboard & Mouse" section and then choose "Additional Layout Option". There, you will see "Caps Lock behavior" which allows converting caps lock to different keys.



            Screenshot from tweak-tool






            share|improve this answer













            The accepted answer is confusing because gnome-tweak-tools doesn't show any "typing" section.



            Instead, click on "Keyboard & Mouse" section and then choose "Additional Layout Option". There, you will see "Caps Lock behavior" which allows converting caps lock to different keys.



            Screenshot from tweak-tool







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jun 6 '18 at 2:18









            zerotimerzerotimer

            211




            211























                1














                On KDE-based distributions (like KDE Neon or Kubuntu) this behavior can be configured in the regular system settings. Open the system settings, select "Input Devices" => "Keyboard" => "Advanced". In the category "Ctrl key position" select "Swap Ctrl and Caps Lock".



                Screenshot of KDE's System Setting's Keyboard module






                share|improve this answer




























                  1














                  On KDE-based distributions (like KDE Neon or Kubuntu) this behavior can be configured in the regular system settings. Open the system settings, select "Input Devices" => "Keyboard" => "Advanced". In the category "Ctrl key position" select "Swap Ctrl and Caps Lock".



                  Screenshot of KDE's System Setting's Keyboard module






                  share|improve this answer


























                    1












                    1








                    1







                    On KDE-based distributions (like KDE Neon or Kubuntu) this behavior can be configured in the regular system settings. Open the system settings, select "Input Devices" => "Keyboard" => "Advanced". In the category "Ctrl key position" select "Swap Ctrl and Caps Lock".



                    Screenshot of KDE's System Setting's Keyboard module






                    share|improve this answer













                    On KDE-based distributions (like KDE Neon or Kubuntu) this behavior can be configured in the regular system settings. Open the system settings, select "Input Devices" => "Keyboard" => "Advanced". In the category "Ctrl key position" select "Swap Ctrl and Caps Lock".



                    Screenshot of KDE's System Setting's Keyboard module







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Feb 22 '18 at 21:52









                    Gerald Senarclens de GrancyGerald Senarclens de Grancy

                    51146




                    51146























                        0














                        gnome-tweaks 3.28.1 has no Typing section.

                        Thus, setxkbmap -layout us -option ctrl:nocaps or setxkbmap -layout us -option ctrl:swapcaps would be feasible options.



                        To make it permanent, you can refer to the answer of @name.






                        share|improve this answer




























                          0














                          gnome-tweaks 3.28.1 has no Typing section.

                          Thus, setxkbmap -layout us -option ctrl:nocaps or setxkbmap -layout us -option ctrl:swapcaps would be feasible options.



                          To make it permanent, you can refer to the answer of @name.






                          share|improve this answer


























                            0












                            0








                            0







                            gnome-tweaks 3.28.1 has no Typing section.

                            Thus, setxkbmap -layout us -option ctrl:nocaps or setxkbmap -layout us -option ctrl:swapcaps would be feasible options.



                            To make it permanent, you can refer to the answer of @name.






                            share|improve this answer













                            gnome-tweaks 3.28.1 has no Typing section.

                            Thus, setxkbmap -layout us -option ctrl:nocaps or setxkbmap -layout us -option ctrl:swapcaps would be feasible options.



                            To make it permanent, you can refer to the answer of @name.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 20 mins ago









                            David JungDavid Jung

                            11




                            11






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f33774%2fhow-do-i-remap-the-caps-lock-and-ctrl-keys%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

                                Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

                                Should I use Docker or LXD?How to cache (more) data on SSD/RAM to avoid spin up?Unable to get Windows File...