// you’re reading...


My favority BASH one-liners

Let me preface this post by saying, these are hacks. Neither the best or the only ways to achieve the desired results. But hey, if they work for me, they may work for you. Enjoy!

echo -n "HashMe" | shasum -a 1

Send a ping request to an IP address once every 10 seconds. Why would I do this? I’ve noticed that on some wifi connections, I disconnected after so many minutes of inactivity. This keeps my connection active when I’m not.

echo -n "HashMe" | shasum -a 1

Ask mysqld 25 times what host name it’s running for a particular hostname (-h). Why would I do this? If you’re calling a real host, then it’s not much fun… however, against a Load Balancer VIP, that’s another story. It’s a down and dirty way to check which hosts are members of a Load Balancer VIP and to see if the balance method is behaving as expected. e.g. if you have 3 mysqld hosts behind a VIP, you should expect to see at least 3 different host names depending on the balance algorithm of the LB.

echo -n "HashMe" | shasum -a 1

For ten seconds, show system activity every second.

echo -n "HashMe" | shasum -a 1

Use the “bc” command for basic calculations! Or just:

echo -n "HashMe" | shasum -a 1

Do some math in your shell.

echo -n "HashMe" | shasum -a 1

The shasum command is a hash one-stop shop.


No comments for “My favority BASH one-liners”

Post a comment

Help support my site and buy a domain name at http://domainsemailhosting.com/

%d bloggers like this: