Trigger Caps Lock From Linux Terminal

Here's a way to trigger caps lock on or off using a command in the terminal.

Why on Earth

Because I have the caps lock key remapped usually. But there's some rando key combination that I hit periodically that turns it back on. Some weird keyboard or OS thing, I'm really not sure. But when it happens, I can't easily undo it. Until now...

Toggle Caps Lock with a Command

Instead of remapping the key, you can trigger the caps lock on or off with a command.

First, install the tool:

sudo apt install xdotool

And then, as needed, run it:

xdotool key Caps_Lock