Correct typing errors in Terminal
If you make an error while entering a Terminal command, you can correct it before pressing the Return or Enter key to run the command.
To skip backward or forward over parts of a command you don’t want to change, press the Left Arrow or Right Arrow key.
To insert characters, type them.
Use the Delete key or press Control-H to erase unwanted characters, then type the new characters.
To erase what you typed and start again, press Control-U.
To reposition the cursor within the current command, hold down the Option key while using the mouse or trackpad to reposition the cursor.