π Checking IP Address
Think of your computer like a house on the internet. The IP address is your house's addressβit tells the network where to send data. Without it, your computer would be lost in the network world. There are two common ways to check your IP on Linux.
Using ifconfig
This command lists all network interfaces (like Ethernet, Wi-Fi) and their details: IP address, netmask, MAC address, etc.
enp0s3: flags=4163mtu 1500 inet 192.168.1.10 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::a00:27ff:fe4e:66a1 prefixlen 64 scopeid 0x20<link>
In the output:
- inet 192.168.1.10 β this is your IPv4 address.
- inet6 ... β this is your IPv6 address.
Using ip a
This is a modern alternative to ifconfig. It gives more structured info about interfaces and addresses.
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
group default qlen 1000
inet 192.168.1.10/24 brd 192.168.1.255 scope global dynamic enp0s3
inet6 fe80::a00:27ff:fe4e:66a1/64 scope link
In the output:
- inet 192.168.1.10/24 β your IPv4 address with subnet.
This command is much cleaner and recommended for modern Linux systems.
Quick Tip
If you only want your IP, you can filter it:
This shows only IPv4 addresses.
Real-life analogy
If your Wi-Fi router is a city, ifconfig tells you which street (IP) your house is on and which postal code (subnet) it belongs to. ip a is like a GPS that not only shows your address but also the road layout and traffic info (network state). This is the foundation because before you can do anything on a network, you need to know where your "house" is.