xmodmap

Remap keyboard keys and mouse buttons in X11

brewmacoslinux
Try with needOr install directly
Source

About

Modify keymaps and pointer button mappings in X

Commands

xmodmap

Examples

swap caps lock and control keys$ xmodmap -e 'remove Lock = Caps_Lock' -e 'remove Control = Control_L' -e 'keysym Caps_Lock = Control_L' -e 'keysym Control_L = Caps_Lock' -e 'add Lock = Caps_Lock' -e 'add Control = Control_L'
remap a key using configuration file$ xmodmap ~/.xmodmaprc
view current keyboard key mappings$ xmodmap -pke
view current pointer button mappings$ xmodmap -pp
swap left and right mouse buttons$ xmodmap -e 'pointer = 3 2 1'