Here are the steps to check the IP address in Linux:
Open a terminal: Launch the terminal application on your Linux system. This can typically be done by searching for "Terminal" in the application launcher or using a keyboard shortcut (e.g., Ctrl+Alt+T).
-
Enter the command: Once you have the terminal open, enter one of the following commands:
- For
ifconfig
: Typeifconfig
and press Enter. - For
ip addr
: Typeip addr
and press Enter. - For
hostname -I
: Typehostname -I
and press Enter. - For
curl ifconfig.me
: Typecurl ifconfig.me
and press Enter.
- For
View the IP address: The command output will display the IP address information. Look for the section or line that specifies the IP address. It should be labeled as "inet" or "inet addr".
Interpret the IP address: The IP address is usually presented in the format of four sets of numbers separated by periods (e.g., 192.168.0.1). This is the address assigned to your Linux system on the network.
Note that the specific command and output may vary depending on your Linux distribution and version.
Command | Description | Example |
---|---|---|
ifconfig | Displays the configuration information of all network interfaces, including the server's IP address. | ifconfig |
ip addr | Lists detailed information of all network interfaces, including the server's IP address. | ip addr |
hostname -I | Returns all IP addresses of the server, separated by spaces. | hostname -I |
curl ifconfig.me | Retrieves the server's public IP address using the HTTP protocol. | curl ifconfig.me |
Please note that the examples assume the commands are being executed in a terminal on a Linux system. The output will vary depending on the server's network configuration and environment.
To get more detailed info about how to get ip address in Linux, check out this article here.
Top comments (0)