Is it possible to select part of a string in the bash terminal and delete it at once, rather than navigating to a point in the command and backspacing it all??
thanks!
Is it possible to select part of a string in the bash terminal and delete it at once, rather than navigating to a point in the command and backspacing it all??
thanks!
See this. Alternatively, set -o vi
to have vim-like key bindings.
Note that the list given in the link is not full. You might read man bash
for a good reference. Usually, ALT-x might be replaced by ESC, x if you run bash inside a terminal that uses Alt-letter shortcuts for windowing system.
I'm using emacs bindings and my favourite command line shortcuts, which were not included in the previously linked tutorial, are the following:
^W - delete last word
meta-b - move cursor back one word
^R - find a previously used command
!$ - last attribute of the last command
!! - last command
You can also manipulate the history with regexps, although that could quickly get quite messy. See "man zshexpn" for reference, mostly the same regexp syntax works for bash also.
Example:
1) If you execute the following command:
echo first second third fourth fifth
2) Then you could execute the same command and remove "first" by:
!!:s/first//
If this was not what you were after, please clarify on your question! :)
I'm not 100% sure I understand your question.
If you are at the interactive command line:
ctrl-u
: Deletes everything to the left of your cursorctrl-k
: Deletes everything to the right of your cursor