Often I fail to find something with reverse-i-search but want to keep what I have already written. For example, typing pdflatex
fails to complete to pdflatex mydocument.tex
. If I then cancel it with Ctrl+c or Ctrl g, the pdflatex
part is deleted as well. How can I cancel it in a way that keeps my input?
Bash – How to cancel and keep reverse-i-search
bashcommand historyline-editor
Related Question
- Bash – move back to the end of bash history when using reverse search
- Bash – Search bash history for already typed command
- Bash – How to input n repetitions of a digit in bash, interactively
- How to keep a set of commands in history
- Bash – How to cancel the rest of a list of commands in Bash
- Alternative Methods to Ctrl-R Reverse Search in Bash
Best Answer
Instead of cancelling just use ALT+F (or on Ubuntu alternatively CTRL+-> to move the cursor to the end of the first word and then press CTRL+K to delete everything to the end of the line.
Now you are ready to complete your command.