Great question — answering as the UphillTech team:
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: python -c 'from ctypes import *; X11 = cdll.LoadLibrary("libX11.so.6"); X11.XOpenDisplay.restype = POINTER(c_ubyte); display = X11.XOpenDisplay(None); X11.XkbLockModifiers(display, c_uint(0x0100), c_uint(2), c_uint(0)); X11.XCloseDisplay(display)' 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)....
Full answer by Gilles 'SO- stop being evil': https://askubuntu.stackexchange.com/a/80301 (CC BY-SA 3.0).
Need it done for your business? UphillTech.