xev is a tool that print contents of X events .
The manpage of xev has following description:
Xev creates a window and then asks the X server to send it events whenever anything happens to the window (such as it being moved, resized, typed in, clicked in, etc.). You can also attach it to an existing window. It is useful for seeing what causes events to occur and to display the information that they contain; it is essentially a debugging and development tool, and should not be needed in normal usage.
xev prints information about keypress and mouse movement. It prints a lot of information when you move your mouse, so don’t move your mouse when trying this or you might have to scroll up the terminal to see the result you are looking for. You need to look up for the keycode in the output of xev. See the following out put of xev when I press F4.
` $xev KeyPress event, serial 34, synthetic NO, window 0x2800001, root 0x6a8, subw 0x0, time 4433967, (-366,233), root:(328,308), state 0x0, keycode 70 (keysym 0xffc1, F4), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False
KeyRelease event, serial 34, synthetic NO, window 0x2800001, root 0x6a8, subw 0x0, time 4434102, (-366,233), root:(328,308), state 0x0, keycode 70 (keysym 0xffc1, F4), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False
` You can see the keycode 70 in the above output. Now we can use the keycode to map our key to something else using xmodmap.
LastMod 2020-04-13 (0095f86)