To make this work for the right option key, you need to set the key modifier to act as an escape sequence.
First, you need to set your left ⌥ key to act as an escape character.
After that, you can either change the current shortcut for ⌥ ← or create a new one in the profile shortcut keys with the following settings:
Keyboard Shortcut: ⌥←
Action: Send Escape Sequence
Esc+: b
Now we need to repeat a similar process for the ⌥→ keyboard shortcut with the following settings:
Keyboard Shortcut: ⌥→
Action: Send Escape Sequence
Esc+: f
That’s all we need to do. After we are done, we may need to restart the iTerm to be able to use the changes that we just made.
Now we can skip entire words on the command line interface by holding down the left ⌥ key and hitting ← or →.
Delete a word - Send Hex Codes - 0x1b 0x08
or 0x17
Delete a line - Send Hex Codes - 0x15
Go to your iTerm preferences select "profiles" then "key" and change your presets in "Natural Text Editing"