Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Consider the following bash prompt, where ^ denotes the prompt location:

svn commit -m very/long/path/to/some/file "[bug 123456] Fix the pixel issue"

I'd like to commit a different file with the same message. How can I delete the current word, from cursor location to the next space? Is there also a shortcut for backward deletion, form the cursor to the first space backwards?

Update: ctrl+w erases backwards, but which shortcut erases one word forward?

share|improve this question
Ctrl u is an option for erasing from cursor location to beginning... – nutty about natty Apr 8 '13 at 15:23
Try alt + d, that might be useful, when emacs editing mode is set. – user76204 Apr 8 '13 at 16:20
@Mik how do you enable emacs mode? – Adam Matan Apr 9 '13 at 9:00
@AdamMatan set -o emacs enables it, but it is usually the default; if not, you can put that line in .bashrc or .bash_aliases, then source the file or reload the terminal. However, then the shortcuts you may be used to in vi mode won't be available, although ones such as ctrl+c will because they are not Bash shortcuts. – user76204 Apr 9 '13 at 9:25

1 Answer 1

up vote 22 down vote accepted

I answered similar question here:

The only difference is you have to use "shell-kill-word" command instead, since you want to delete forward.

There is also a "kill-word" command with Meta+d shortcut (try Esc+d if you don't have Meta key). It will delete only one part of path at once.

share|improve this answer
Alt-d works for me – ricab Jan 20 at 14:24
Generally, in the world of keyboards where Meta doesn't exist, Alt = Meta. – Nate C-K Mar 20 at 3:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.