Boosted by glyph ("Glyph"):
cR0w@infosec.exchange (":rainbowCrow:") wrote:
You know how there are weird tricks with computer stuff that you think everyone knows but they don't? I live learning and teaching new things like those when they come up.
Today's was the carat substitution in bash. It probably works in other shells too but IDK, I'm too old to learn a new shell.
The way it works is fairly similar to the
/insedor similar. You can use them to run the previous command but with a string substitution.For example, let's say I entered this command:
dig A cascadiacrow.orgWhen it fails to resolve, I realize it was a
.comdomain. Rather than retyping the command, or hitting the up arrow to change the previous command, you could do this:
^org^com^And it would run:
dig A cascadiacrow.comKind of cool with those one liners you spend way too much time on and find a typo.
Anyway, I used it and someone thought it was magic so if it's new to you too, happy Monday.