Sure! Here is a step-by-step guide on how to view your current public IP address using the Linux shell:
-
Open a terminal: Launch the terminal application on your Linux system. You can usually find it in the Applications menu or by searching for \"Terminal\" in the system's search bar.
-
Run the following command: In the terminal, type the following command and press Enter:
shell
curl ifconfig.me
This command uses the curl
utility to fetch the content of the ifconfig.me
website, which will display your public IP address.
Example output:
203.0.113.1
In this example, the IP address is 203.0.113.1
.
- Alternatively, you can use another command to achieve the same result. In the terminal, type the following command and press Enter:
shell
dig +short myip.opendns.com @resolver1.opendns.com
This command uses the dig
command-line tool to query the OpenDNS resolver for your public IP address.
Example output:
203.0.113.1
Again, the IP address in this example is 203.0.113.1
.
By following these steps, you can easily view your current public IP address using the Linux shell.
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:linux shell查看当前外网IP - Python技术站