83
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"); display = X11.XOpenDisplay(None); X11.XkbLockModifiers(display,...