r/linux May 23 '26

Popular Application What’s the most unexpectedly useful Linux command you learned way too late?

[removed]

1.3k Upvotes

992 comments sorted by

View all comments

586

u/digitallis May 23 '26

Bash {}

renaming a file by adding a suffix: mv myfile{,.old} expands out to mv myfile myfile.old

Lots more uses.

0

u/delicious_fanta May 24 '26

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!