LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Erasing from home up to first blank as I type at the prompt. (https://www.linuxquestions.org/questions/linux-newbie-8/erasing-from-home-up-to-first-blank-as-i-type-at-the-prompt-847019/)

stf92 11-28-2010 06:20 AM

Erasing from home up to first blank as I type at the prompt.
 
GNU bash 3.1.17

Hi:
I say there must be, in bash, a keystroke combination that does this: I type say, two words at the prompt. Then I press HOME. And now, holding down some control key, I press a key that erases from current cursor position up to the first blank (the space between the two words). If I am right, which is the key combination? You could as well refer me to the bash manual section where the different combinations, one of them a control key are listed. Thanks in advance.

ntubski 11-28-2010 06:53 AM

It depends on what you think a word is. M-d (ALT+d or ESC d) will do kill-word but a word is defined as a sequence of [a-zA-Z_] so (! represents the cursor)
Code:

$ !command-one command-two
# press M-d, now you have
$ !-one command-two

There isn't a forwards equivalent to C-w (unix-word-rubout).
See Commands for Killing.

stf92 11-28-2010 07:31 AM

Yours has been a most useful post to me. I see what you meant by "my definition":
Code:

aaa bbbbbbbbb    two M-d to erase all
aaa/bbbbbb        two M-d to erase all

To bash, <space> and '/' both of them are separators, I see. Thanks a lot.


All times are GMT -5. The time now is 12:55 PM.