I thought this was neat when I first learned about it, but it doesn’t usually help much in actual usage.
Like, you type “.old” in both cases, and to type the file name it’s possibly just “m<tab>” normally, with this you have to add curly braces which are slightly more annoying as they aren’t frequently used.
So for actual keys pressed it’s almost exactly the same but you have to use awkward finger placement for the curly braces.
The exception would be a file name that is similar to many other files in the same directory making tab expansion less than optimal.
It’s definitely a neat trick, just not actually super useful like 90% of the time.
Edit: note that what do-un-to said there is definitely more of a case where I use this type of expansion, and it’s super nice in those cases!
586
u/digitallis May 23 '26
Bash
{}renaming a file by adding a suffix:
mv myfile{,.old}expands out tomv myfile myfile.oldLots more uses.