Expand Variables in Current Command on Bash Prompt

14 Jun 2011

I always forget the bash shortcut to expand all the variables in the current command, so I am recording it here and outsourcing my memory to a Google search next time I forget.

Here’s how it works:


mkdir tmp
echo "11" > test.txt
mv test.txt tmp/
chmod 600 !$ ( !$ refers to the last word of last command, "tmp" - now type Esc Ctrl+e to expand to the following)
chmod tmp/
# type t Tab for a nice autocomplete
chmod 600 tmp/test.txt

Let's talk

I'm one of the founders of Venmo. If you liked this essay/experiment -- or didn't -- @ me.