Take the 2-minute tour ×

There are multiple reasons why this is useful, including the ability to use shell completion to add a final argument to the command and the ability to see what command you are about to run without using the p option and needing to retype the history reference with an updated time value.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

This works to always expand after you hit a space:

cat >> ~/.inputrc
$if Bash
    " ": magic-space
share|improve this answer
I just saw that a common .bashrc binding is bind Space:magic-space. Seems to work well. –  jonderry May 26 '11 at 21:26
this is awesome, I've been looking for this for years! I was a tcsh holdout because the history tab completion works so well. I didn't think that bash could do anything like it. But thanks to this tip, I can now have something close: Tab: magic-space –  Hans-Christoph Steiner Jul 10 '12 at 2:02
Doh! So close yet so far. Turns out setting magic-space to Tab overrides the normal Tab completion. So lame, bash, so lame. Anyone know if its possible to make bash completion and magic-space both coexist using Tab? That's how it works in tcsh and its wonderful. –  Hans-Christoph Steiner Jul 10 '12 at 2:06

Your Answer


