Summary
macOS
Go to the beginning or end of a line:
Ctrl+A or Ctrl+E
Go to beginning or end of a word:
Alt+Left or Alt+Right
Delete from cursor to the beginning or end of the line:
Ctrl+U and Ctrl+K
Delete from cursor to the beginning or end of a word:
Ctrl+W or Esc+D / Option+D
Exercises
Try typing some words in the terminal and using the shortcuts above to navigate through it or delete it (the exact words don’t matter).
References
Terminal User Guide on Apple Support (see the “Edit a command line” section)