How to Get IPv4 Address on Unix and Linux

Muhammad Husnain Feb 02, 2024
  1. IPv4 (Internet Protocol version 4)
  2. Use Linux Wizard to Get IPv4 Address on Unix and Linux
  3. Use Terminal to Get IPv4 Address on Unix and Linux
How to Get IPv4 Address on Unix and Linux

IP stands for Internet Protocol, which sets out the principles of Internet communication. The Internet Protocol (IP) address is the unique identifier of each device on the Internet that allows the data transmission between connected devices.

IP addresses are assigned by a standard organization called IANA (Internet Assigned Numbers Authority). There are different versions of the IP address, but IPv4 (Internet Protocol Version 4) is the most commonly used for Internet transmission.

IPv4 (Internet Protocol version 4)

IPv4 is a 32 bit long unique address that consists of network and host parts. The network portion is uniquely assigned to the network, and the host portion is assigned to each host in the network.

IPv4 addresses can be private or public. The Private addresses are used only on local networks and cannot transmit data on the Internet.

The IANA launched three ranges of private IP addresses, which are below.

10.0.0.0-10.255.255.255 \\
172.16.0.0-172.31.255.255 \\
192.168.0.0-192.168.255.255

A public IP address is also a global address used to communicate devices (hosts, WEB, VPN, etc.) across the Internet.

There are two easy ways to get IP addresses in Linux: Linux Wizard and Terminal.

Use Linux Wizard to Get IPv4 Address on Unix and Linux

In the Linux Wizard, go to Settings, click on Network, and click the Settings icon in the Wired option.

Linux Wizard

Click on the setting icon in the Wired option.

wired details on linux wizard

A new Linux wizard will appear, and you can check Link Speed, IPv4 Address, IPv6 Address, Hardware Address, Default Route, and DNS.

Use Terminal to Get IPv4 Address on Unix and Linux

There are also many commands to get the IP address in the terminal, e.g., ip address, hostname -I, network manager.

The command hostname -I will give you only the IP address on the terminal.

terminal hostname command

The command ip address will give you a brief description of the IP address.

terminal ip address command

The command nmcli -p device show will give you a detailed description of your networks such as IPv4 Address, IPv4 Gateway, Connection Type (wired/wireless), Network Types, MTU (maximum transmission unit), and Hardware Address.

terminal nmcli command

Muhammad Husnain avatar Muhammad Husnain avatar

Husnain is a professional Software Engineer and a researcher who loves to learn, build, write, and teach. Having worked various jobs in the IT industry, he especially enjoys finding ways to express complex ideas in simple ways through his content. In his free time, Husnain unwinds by thinking about tech fiction to solve problems around him.

LinkedIn