Possible Duplicate:
Keyboard shortcuts in Bash shell

Is there any way I can undo an auto-completion done by bash? For example:

$> ls first/second/t
<Presses tab>
$> ls first/second/third
<realizes it should be fourth and not third>
<presses backspace key till initial prompt is reached>
$> ls first/second/

Is there any way I can replace the irritating backspacing part with some cool combo which undoes the most recent auto-completion?


try undo with Ctrl + _

also Ctrl + W may do what you want. It deletes last word.

  • It works.:) Though for every undo required the CTRL + _ combo has to be pressed twice! Once for undoing the additional space char and the second one to actually undo the suggestion. Any workarounds for this? If not, I'll mark this post as the chosen one. ;-) – sasuke Oct 2 '10 at 18:02
  • Try deleting last word with Ctrl + W – Casual Coder Oct 2 '10 at 18:23
  • I guess there is no single command for the same (CTRL + W and then CTRL + _). Anyways, this should be enough for the time being; solved. Thanks. – sasuke Oct 2 '10 at 18:29
  • 2
    Remember that you can customize such behaviors by editing ~/.inputrc, see man readline for more info and /etc/inputrc to see the default configuration. – cYrus Oct 2 '10 at 18:47
  • @cYrus: Ooh, I didn't know that; though looking at the file makes me feel that changing it would be something pretty hardcore. Skipped for the time being. :-) – sasuke Oct 2 '10 at 19:10

Also try Alt + B and Alt + F (moves backwards and forward). Then you can press Ctrl + K to delete everything from the cursor to the end of the line

Not the answer you're looking for? Browse other questions tagged or ask your own question.