Use alias to save time on the Linux/Unix CLI
As I was walking down the hall just now, a colleague stopped me to ask if I knew how to set up an alias that would take an argument for printf. I was entirely lost in my own thoughts, nowhere near the topic he had in mind at all, so I just kinda stood there looking at him like he was a little green man fresh off the Martian invaders' spaceship. Attempting to land the plane for me, he scribbled an example on the whiteboard for context ... after making incoherent mumbling sounds, I resumed walking towards the water cooler and filled my bottle. On my way back, I let him know: "I'll see what I can figure out."
Is something like this right off the cuff for you? Or is it a web query/AI interaction?
For me, it only took a quick refresher from my ~/.bashrc to get me back on track. I have so many aliases defined ... sheesh. I forget what some of these are for!
Here's an example of how to solve the problem at hand:
[~]$ alias pr='printf "arg1 arg2 %s\n"'
[~]$ pr arg3
arg1 arg2 arg3
[~]$
Is that a hammer in search of a nail? Or is that something you might find useful?
Recommended by LinkedIn
There are days when it feels like I'm always banging my head against the wall of deprecated hardware. I try to ssh to old-and-busted and get the dreaded ssh error, Unable to negotiate ... . One of my aliases defined in my bash config is this one:
dumbssh='ssh -o HostkeyAlgorithms=+ssh-dss -o KexAlgorithms=+diffie-hellman-group1-sha1'
Perhaps a bit childish, definitely passive-aggressive - but old-and-busted deserves no better. So I reach out to the ancient gear (which in Texas slang, we might call a "boat anchor"), like so:
[~]$ dumbssh myuser@old-and-busted
Until such time as the powers-that-be can authorize the funds to allow me to replace this bodanker* then I get to cope. And being too lazy (𝑬𝑭𝑭𝑰𝑪𝑰𝑬𝑵𝑻!!!) to try to memorize all those options, I edit my bash files and "memorize" the alias instead.
*𝙗𝙤𝙖𝙩 𝙖𝙣𝙘𝙝𝙤𝙧: [boe DAYN kur] a worthless paperweight that belongs at the bottom of the nearest body of water; optionally secured by rope or chain to a water-faring vessel, serving in the capacity of an anchor
What's your daily torture? What alias have you come up with to minimize the pain point?