Delete Previous Word
What is Delete Previous Word?
Delete Previous Word: Delete the word to the left of the cursor on the command line. In most terminals, Ctrl+W deletes the word to the left of the cursor. Alt+Backspace often does the same with slightly different rules for punctuation. In editors, Ctrl+Backspace or Option+Backspace deletes the previous word. It is much faster than holding Backspace when you mistype a long argument or want to change the last part of a command.
Frequently asked questions about Delete Previous Word
What should you keep in mind with Delete Previous Word?
A few related shell shortcuts are worth knowing too. Ctrl+U clears everything before the cursor, Ctrl+K everything after it, Ctrl+A jumps to the start of the line and Ctrl+E to the end. Together they make editing long commands, such as Docker or kubectl calls with many options, much less frustrating. Note that Ctrl+W closes the tab in many browser-based terminals.
At a glance
| Category | Keyboard shortcuts |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |