Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to change the definition of the word separators in bash? This will allow me, for example, to do ctrl+w (delete previous word) at the end of this path:


and the effect will be that only "file" will be deleted, and not the whole path.

edit: to be more clear, word deletion is just one possible usage, but I'm interested in moving between words, etc. Also, I want to be able to configure underlines and other chars as separators, not only slash.

share|improve this question

You don't need to redefine or bind anything. Use Alt+Backspace to achieve the desired result.


To move between words use Alt+b, Alt+f for b ack and f orward. This will also take _ as a seperator.

share|improve this answer
And how do I delete the next word, move between words, etc? – JohnnyW Jun 30 '13 at 12:07

From Is it possible to configure ctrl-w (delete word)?:

You should be able to use Esc, then backspace to delete words delimited by slashes.

You can change this by putting this in you .bashrc:

bind '\C-f:unix-filename-rubout'

Now use Ctrl+f to do what you want.

share|improve this answer
thanks! would upvote if I had enough rep. This partially answers my question (please see my edit). – JohnnyW Jun 30 '13 at 11:58

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.