Yes, I Know IT ! ๐ŸŽ“ is a user on mastodon.social. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Yes, I Know IT ! ๐ŸŽ“ @YesIKnowIT

With Bash history, `!:0` expands to the previous command name.

echo 1
!:0 2

ยท Yes I Know IT ยท 1 ยท 0

@YesIKnowIT
I didnt get it. What is actualy executed running this command?

@Kai
You can consider !:0 as a "shortcut" to the previously typed command name.

echo 1
!:0 2

is the same thing as

echo 1
echo 2

This is mostly useful for long command name. And as a generalization, you can use a similar syntax to alias any "word" of the previous command:

mkdir /tmp/x
cd !:1

Finally, it supports range:

mkdir abracadabra barbapapa chachacha dingelidon
chmod og-rx !:1-3

It can avoid lots of typing for complex and hard to spell arguments, eps. when working on the console.

@YesIKnowIT
Thanks for the clarification!
Thats really usefull.