Linux shell scripts are useful for a lot of tasks. A brief tutorial on them can be found here.
Here is a very simple shell script that on executing will display the public IP address of PC.
Using any text editor (nano in this example), make the script as follows :
#!/bin/bash
echo "The Public IP for this system is : "
curl -s icanhazip.com
echo "The Public IP for this system is : "
curl -s icanhazip.com
What this script does is simply fetch the public IP address from icanhazip.com.
Accessing icanhazip in a browser will display the public IP too but for this a browser needs to be used every time.
Instead this can be directly done from Linux Terminal, so the script.
Finally, make it executable and run it :
sudo chmod a+x getpublicip.sh
./getpublicip.sh
It will display the public IP of system right from the Linux Terminal.
All done.
Thanks for sharing a very specific guide
Thank you for your post, I look for such article along time, today i find it finally.
this post give me lots of advise it is very useful for me !