bash script useful tips

I’ve spent last 2 days scripting virtual server deployment on Amazon cloud. For my reference, these are some useful commands I had to use to get the job done.
1. Hash “Hello World” string using SHA256 algorithm

echo -n "Hello World" | shasum -a 256

You can also hash a file

shasum -a 256 myfile.ext

2. Display server IP address by stripping out all other network information, including the local 127.0.0.1 IP