Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For instance, when I type a path in terminal

cd project/example/one

I can press Ctrl+W and remove the entire "word" project/example/one. Sometimes it's not very useful.

Are there any shortcuts for removing only one word to make like following?

cd project/example/
share|improve this question

1 Answer 1

up vote 2 down vote accepted

In shells with GNU readline you could combine the backward-word (Move backward a word, Meta-b) and kill-line (Kill the text from the current cursor position to the end of the line, Ctrl-K) commands.

There's also backward-kill-word, by default on Meta-Backspace.

To get commands in zsh to use the same word boundaries (it doesn't use GNU readline), I had to set select-word-style bash.

share|improve this answer

Your Answer

 
discard

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.