When working in a shell I would often like the ability to see what public IP I’m on. There is no build in function, which I know of anyway. So after a bit of searching I found this one-line-wonder, and wrote it into a little script.
#!/bin/bash
wget -q -O - checkip.dyndns.org
|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
echo
exit 0
1. Create the script with the command nano whatismyip.sh
2. Paste in the code
3. Press Ctrl+X to exit
4. Press Y to save
5. Enter the command chmod 777 whatismyip.sh to make the script executable
6. Enter ./whatsmyip.sh to run the script
You’ll need nano, wget and sed installed, but that’s default on many distroes.
And yeah that’s not my real IP on the picture.
Please follow and like me:
good one