Bash – shortcut in bash to delete the last segment of a path

bash

I've become pretty proficient with a number of bash shortcut keys that make my bash-ing faster: C-a/C-e, C-u, C-w, M-f/M-b, C-r etc. One common task that I haven't found a good shortcut for though is when I want to delete the last segment of a path:

Say I have

ls ~/projects/arcaneweb/libraries

and I realize I actually meant

ls ~/projects/arcaneweb/sources

Is there a way to just delete libraries, saving a load of keystrokes?

Best Answer

A single shortcut: M-backspace

Alt + ←      

Related Question