- How To Disable Caps Lock Key in Linux using CLI or GUI
- How to use xmodmap command to turn off caps key
- setxkbmap command to turn off caps locks key
- Disabling the caps lock key in the command line using xdotool
- A note about a virtual terminal
- How to deactivate Caps Lock in Linux using gnome-tweaks
- Summing up
- Как отключить Caps_Lock?
- How to disable caps lock in Linux
- Ubuntu 14.04
- Ubuntu 12.04
- Много чертыханий или как отключить Caps Lock в Ubuntu
- How do I turn off Caps Lock (the lock, not the key) by command line?
- 5 Answers 5
How To Disable Caps Lock Key in Linux using CLI or GUI
How to use xmodmap command to turn off caps key
To turn off caps lock key, enter:
$ xmodmap -e «remove lock = Caps_Lock»
Now caps key is disabled. To enable caps key, enter:
$ xmodmap -e «add lock = Caps_Lock»
Add following code to your shell startup file
/.profile file:
$ echo ‘xmodmap -e «remove lock = Caps_Lock»‘ >>
setxkbmap command to turn off caps locks key
You can also use the setxkbmap command, which maps the keyboard to use the layout determined by the options specified on the command line. To turn off caps lock key, enter:
$ setxkbmap -option ctrl:nocaps
To reset caps lock. enter:
$ setxkbmap -option
Disabling the caps lock key in the command line using xdotool
First, install xdotool using the dnf command/zypper command or apt command as per your distro. For example:
$ sudo apt install xdotool
Then we can toggle Caps Lock using the following command:
xdotool key Caps_Lock
Please note that we rerun the above command to go back to the previous state. In other words, type:
xdotool key Caps_Lock
A note about a virtual terminal
We can use the following command turn on caps:
setleds -D +caps
Then turn caps back off if required:
setleds -D -caps
The -caps or +caps option clear or set CapsLock when using VT.
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
How to deactivate Caps Lock in Linux using gnome-tweaks
You need to use GNOME Tweak Tool. It allows the adjustment of several advanced GNOME options that can’t be configured in gnome-control-center. Install it using the apt command/apt-get command:
sudo apt install gnome-tweaks
And then start it:
gnome-tweaks
Click on the Keyboard & Mouse > Additional Layout Option:
Set up Caps Lock behaviour as per your needs.
Summing up
You learned various commands and GUI tools to set up cap lock key settings on a Linux desktop. Further readings:
man setxkbmap
man xmodmap
man setleds
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Category | List of Unix and Linux commands |
---|---|
Documentation | help • mandb • man • pinfo |
Disk space analyzers | df • duf • ncdu • pydf |
File Management | cat • cp • less • mkdir • more • tree |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Linux Desktop Apps | Skype • Spotify • VLC 3 |
Modern utilities | bat • exa |
Network Utilities | NetHogs • dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop |
Searching | ag • grep • whereis • which |
Shell builtins | compgen • echo • printf |
Text processing | cut • rev |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Comments on this entry are closed.
I have switched ESC and CAPS_LOCK, which makes vim much easier to use.
Making caps lock an additional control key is ver useful also. It makes typing shortcuts a lot easier.
I want to disable a bunch of keys because my daughter accidently presses them when she is playing a game on her “Aspire one”. The method worked for many keys but not all.
For example to disable the tux-key (the linux equivilent to the windows-key)
xev doesn’t show a keycode when i press the tux key
infact i don’t see any Keypress event, just a lot of other events.
]$ xmodmap -pm
xmodmap: up to 3 keys per modifier, (keycodes in parentheses):
shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x6d)
mod1 Alt_L (0x40), Meta_L (0x9c)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x7f), Hyper_L (0x80)
mod5 Mode_switch (0x5d), ISO_Level3_Shift (0x71), ISO_Level3_Shift (0x7c)
———————————————————————————————
I thought it might be possible to just remove the mapping for “mod4 Super_L”, but even that did not work.
Any tips on this, most welcome.
//The Lowley Worm
I think, that the command
xmodmap -e “remove lock = Caps_Lock”
only works if your caps lock is off
How Can I Disable the Keyboard in RHEL-4.
to Aovid the Input In My Absens.
Pradeep
Maybe try lock screen?
xmodmap -e “remove lock = Caps_Lock” is my favorite command to add as ´startup application´ 🙂
xmodmap -e “remove lock = Caps_Lock” works as a charm, but when you replug the USB keyboard caps lock is functional again.
I use this to discourage my son of typing caps-lock-on-character-caps-lock-off. This sounds very unusual, yet I discovered there are more people who have developed this unwanted habit.
As it seems, I should link the xmodmap command to a udev event.
Hey you saved me a reboot 🙂 Well, i sometimes getting into trouble with x11vnc with my X keyboard configuration (grp:ctrl_shift_toggle,grp:shift_caps_switch,grp_led:num) – leaving me with LOCKED CAPS when i just pushed it to switch back to english when connected via VNC. Btw, running ‘setxkbmap -option’ to reset this behaviour to default, turn off annoying caps lock, and then setxkbmap -option with the above line from xorg.conf resolves the deal. and this happened few times before – i needed reboot. Thank You 😉
Command did worked but I discoverd “Gnome Tweaks” tool. Thank you, mate.
Источник
Как отключить Caps_Lock?
Как (сейчас) отключается capslock?! Вопрос интересует, как ручками отключить
Пробовал и находил следующие решения:
По началу думал, что может дело в том что у меня лампочка от caps на смену раскладки завязана, но когда в Параметрах системы KDE удалось выключить чтобы от нажатию на клавишу caps буквы не становились с верхним регистром — сомнение пропало
Поставьте xev, посмотрите код клавиши и попробуйте так:
xmodmap -e ‘keycode (код клавиши)=’
У меня капс 66-й, т.е. :
xmodmap -e ‘keycode 66=’
Что значит отключить? Чтобы индикатор не зажигался или «чтобы от нажатию на клавишу caps буквы не становились с верхним регистром» или переключить текущий режим ввода клавиатуры в нижний регистр?
что бы буквы большими не становились
Спасибо, вот пару минут назад тоже подобный способ решения нашел
Спасибо, действительно данный способ работает
Мне только единственным данный способ не понравился, насторожил, то что сообщается:
Я наверно все же на следующем способе остановлюсь:
Еще вот, на будущее, Xmodmap и setxkbmap это для X , а для консоли, там файл раскладки сам править/собирать что ли, какой-нибудь скажем: ruwin_ct_sh-UTF-8.map.gz ? Или все же через loadkeys или через что-то еще можно избавить от caps и верхнего регистра?
Если залезть внутрь файлов «/usr/share/X11/xkb», то все эти option превращаются в несколько команд. Упомянутый «ctrl:nocaps» будет:
С консолью, насколько я знаю, такого большого числа вариантов модификации расладки клавиатуры нет. Можно править файл ruwin. (хотя лучше править его копию), можно просто вызывать loadkeys, допустим:
Источник
How to disable caps lock in Linux
The caps lock key is a vestige from older times. It is completely useless today and extremely irritating because it gets turned on by mistake while using programs like Vim. It is a good idea to turn it off completely by disabling it.
The setxkbmap program can be used to disable caps lock completely in all desktop environments and window managers by mapping it to the Ctrl key:
To apply this setting every time you login to any desktop environment, add the above line to your
/.profile file. Log out and login to see the effect of this option.
Other methods to disable caps lock that I used to try earlier are given below:
In newer versions of Kubuntu: System Settings → Input Devices → Keyboard
In older versions of Kubuntu: System Settings → Hardware → Keyboard → Advanced.
Enable Configure keyboard options and under the tree of options choose Caps Lock is disabled.
Ubuntu 14.04
Install the GNOME Tweak Tool:
Open it by typing Tweak Tool in the Dash. Choose Typing → Caps Lock key behavior. Confusingly, it is shown as Disabled. But this means that any customization on that is disabled. In the dropdown choose Caps Lock is disabled option and you are done!
Ubuntu 12.04
Open Keyboard Layout and click on the keyboard layout you are using, for example English (US). Click on Options → Caps Lock key behavior and choose Caps Lock is disabled.
Источник
Много чертыханий или как отключить Caps Lock в Ubuntu
Все знают, что во всех раскладках самая ненужная клавиша – это Caps_Lock. Мало того, что не нужная, так ещё и вредная: вечно пальцем в неё попадаешь при неслепой печати. Недаром Интернет изобилует рецептами отключения этой клавиши. В Windows Caps Lock отключается правкой системного реестра, а как в Ubuntu?
Раньше я редактировал файл /usr/share/X11/xkb/keycodes/xfree86, превращая строки, содержащие слово CAPS, в комментарии, и был вполне доволен результатом. Но после какого-то обновления дистрибутива это перестало работать. Потом пару раз менял карту клавиш командой
xmodmap -e ‘remove Lock = Caps_lock’
Но теперь и этот трюк не проходит. Для других кнопок срабатывает, а для Caps Lock – нет. Признаюсь: ругал Марка Шаттлворта, не особенно выбирая лексику. А зря.
Оказывается, компания Canonical позаботилась о страждущих; просто надо было не лениться читать мануал. Всё просто. Далее по шагам.
Вызываем даш, переключаемся на русский и начинаем вводить «параметры системы». Уже после ввода «па» в первой же строчке появляется значок «Параметры системы». Кликаем по нему, чем открываем окно «Параметры системы».
Кликаем по значку «Раскладка клавиатуры», открывается одноименное окно. Кликаем кнопку «Параметры», появляется окно «Параметры раскладки».
В окне «Параметры раскладки» отыскиваем строчку «Поведение клавиши Caps Lock», кликаем по ней, и строчка распадается на дюжину радиокнопок.
Находим радиокнопку «Отключить Caps Lock» и жмём.
Закрываем все окна, имеющие отношение к параметрам системы.
Источник
How do I turn off Caps Lock (the lock, not the key) by command line?
For some reason my laptop is stuck in Caps Lock. I have the Caps Lock key mapped by xmodmap to hyper_l , so I don’t have a caps_lock key to turn it off. Is there a way I can turn it off by command line? It would be nice if I could reset the lock state without resetting my computer, especially for future reference. This has happened before, but I would like to know now how to do it properly this time.
5 Answers 5
I don’t know of any command line tool for that in Ubuntu. (For Num Lock, there is numlockx .) Here’s a one-liner that you can copy-paste into a terminal window:
Here it is again in a more expanded form. We use the Python ctypes library to call C functions from the X library directly. The function XkbLockModifiers changes the state of the keyboard locks, on the core keyboard ( XkbUseCoreKbd = 0x0100), affecting Caps Lock (2), setting it to 0 (off).
If you have a stuck modifier, change 2 to the mask of the modifiers you want to turn off. The modifiers are 1=Shift, 2=Lock (Caps Lock), 4=Control, 8=Mod1, 16=Mod2, 32=Mod3, 64=Mod4, 128=Mod5. Run xmodmap -pm to see what Mod1 through Mod5 correspond to. For example, to turn off all modifiers, call X11.XkbLockModifiers(display, c_uint(0x0100), c_uint(255), c_uint(0)) . To turn on Num Lock which is on Mod2 and at the same time turn off Caps Lock, call X11.XkbLockModifiers(display, c_uint(0x0100), c_uint(2 | 16), c_uint(16)) .
Here’s a C version if you want to make a small binary instead of invoking Python. Compile with gcc -O -Wall -o caps_lock_off caps_lock_off.c -lX11 , with the packages build-essentials and libx11-dev installed.
Also possibly of interest is a way to temporarily ignore Caps Lock:
After this, Caps Lock will effectively be permanently off, until you reenable it with xkbset nullify -lock .
Источник