On bash command-line, how to delete all letters before cursor?
In zsh, Alt+w clears all characters before the cursor.
In contrast to bash this does NOT cut them; it just deletes them.
This applies to zsh's Emacs mode (which is the default), NOT to Vi mode.
Ctrl-u
- Cut everything before the cursor
Other Bash shortcuts,
- Ctrl-a
Move cursor to beginning of line
- Ctrl-e
Move cursor to end of line
- Ctrl-b
Move cursor back one word
- Ctrl-f
Move cursor forward one word
- Ctrl-w
Cut the last word
- Ctrl-k
Cut everything after the cursor
- Ctrl-y
Paste the last thing to be cut
- Ctrl-_
Undo
And discover more via man page for bash shell: man bash
Additional bash command-line shortcut cheat sheet: http://www.bigsmoke.us/readline/shortcuts
See the documentation here: http://www.gnu.org/software/bash/manual/bashref.html#Commands-For-Killing
Obligatory: Learn more about Bash, Linux, and Tech through Julia's comics: https://twitter.com/b0rk/media