Get Public IP Address from Terminal
terminalbeginnerlinuxmacos
Quick command to retrieve your public IPv4 address from the command line using curl
#terminal#networking#ip-address#curl#command-line
Get Public IP Address from Terminal
Overview
Quick command to retrieve your public IPv4 address from the command line using curl
Prerequisites
- Terminal access
- Curl
Instructions
To get your public IPv4 you just need to type this command:
echo $(curl -sS ifconfig.me)
You can add it to your
rcconfig file with an alias such aspublicip,whatsmyip, or whatever you want!
Troubleshooting
If you encounter any issues:
- Verify all prerequisites are installed
- Check command syntax carefully
- Ensure you have necessary permissions