I have the following path :

$ vim /path/to/some/where

If I press Ctrl + w, It removes entire text to first space. The result would be :

$ vim 

How do I delete just the word next of last slash with comination keys?

  • Since this is shell functionality it would be nice to know which shell you are using (bash, zsh, tcsh, dash).
    – Anthon
    Commented Nov 10, 2014 at 9:01
  • 1
    bash tag added. Commented Nov 10, 2014 at 9:03
  • Technically speaking, there are four words next to a slash in that string...
    – jasonwryan
    Commented Nov 10, 2014 at 9:08
  • @jasonwryan Edited. Remove word next of last slash! Commented Nov 10, 2014 at 9:10
  • possible Askubuntu question:Deleting input back to the last forward slash Commented Nov 10, 2014 at 11:01

2 Answers 2


Try Alt + Backspace.

From bash documentation:

backward-kill-word (M-DEL)

Kill the word behind point. Word boundaries are the same as backward-word.

  • Since Ctrl-H is the same as backspace, Ctrl-Alt-H also works for backward-kill-word
    – wrgrs
    Commented Jan 23, 2018 at 14:12

You can type

Alt+b Alt+d

I don't know of a single combination that does what you are asking for.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .