If you want to:

then please read on.

  1. Open iTerm2's Preferences
  2. Switch to Profiles tab
  3. Select your profile on the left and switch to tab Keys on the right
  4. Add your custom keys by click on + button
  5. Focus on input Keyboard Shortcut in the new dialog and press the target key
  6. Select action Send Hex Code or Send Escape Sequence
  7. Add the hex code

For the most common Hex Code:

Here is the Full ASCII Table