The quickest way to see your IP address

Open a terminal and type ip addr, then press Enter. You will see a list of all network connections on your machine. Look for the line that starts with "inet" — that is your IPv4 address. It usually looks like 192.168.1.100 or 10.0.0.50. If you see "inet6" instead, that is your IPv6 address, which starts with letters and colons.

The ip addr command shows every network interface your Linux system has, including your main connection and any virtual ones. Most of the time you only care about the one labeled "eth0" or "wlan0" — those are your actual network connections. Ignore "lo", which is the loopback address your computer uses to talk to itself.

If ip addr does not work on your system, try hostname -I instead. This older command shows just the IP addresses without all the extra detail. It is faster if you only need the number itself.

Key Takeaways

  • Type ip addr in a terminal to see all your IP addresses at once, with IPv4 and IPv6 listed separately.
  • Look for lines starting with "inet" for IPv4 or "inet6" for IPv6 — these are the actual addresses your computer uses on the network.
  • The "lo" interface is your loopback address and is not your real IP — skip it and look for eth0, wlan0, or similar instead.
  • If ip addr does not work, use hostname -I to get just the IP addresses without extra information.
  • Your IP address changes depending on whether you are connected by ethernet cable or WiFi, and both will show up in the same list.

Understanding what each part of the output means

When you run ip addr, each network interface gets its own numbered section. The number (1, 2, 3) does not matter — what matters is the name. "eth0" is usually your wired ethernet connection. "wlan0" is your WiFi. "docker0" or "veth" entries are virtual networks created by software and you can ignore them unless you are running containers.

Next to the interface name, you will see "UP" or "DOWN" in angle brackets. UP means the connection is active and working. DOWN means it is disabled or disconnected. If you see "UP" next to wlan0 but DOWN next to eth0, you are currently using WiFi.

The actual IP address comes after "inet". Everything after the forward slash (like /24) is the subnet mask — it tells your computer which other machines are on the same local network. You usually do not need to worry about this number unless you are setting up a network yourself.

Other commands that show your IP address

The ifconfig command does the same job as ip addr but uses older formatting. Type ifconfig and look for "inet addr:" followed by your IP. This command is less common on newer Linux systems but still works on most machines. It shows the same information, just arranged differently.

For a single line of output, use hostname -I. This prints only the IP addresses, one per line, with no extra detail. It is useful if you are writing a script or just want the number without scrolling through a full report.

If you want to see only your WiFi IP, type ip addr show wlan0. Replace "wlan0" with "eth0" if you want your wired connection instead. This filters the output to show just one interface, which is cleaner when you have many connections.

Finding your IP address on a specific network interface

Sometimes your Linux machine has multiple network connections active at once — maybe WiFi and ethernet, or a virtual network for containers. To see the IP of just one, use ip addr show followed by the interface name.

Type ip addr show eth0 to see only your wired connection, or ip addr show wlan0 for WiFi. The output will show just that one interface and its address. This is faster than scrolling through a long list if you know which connection you need.

You can also use ip -4 addr to show only IPv4 addresses, or ip -6 addr for only IPv6. This filters out the type you do not need and makes the output shorter.

What to do if you see multiple IP addresses

A single network interface can have more than one IP address assigned to it. This happens when you set up virtual hosts, run containers, or configure your network manually. The first "inet" line is usually your main address — the one other computers use to reach you. Any additional ones are secondary.

If you are not sure which IP is the right one to use, check which interface is marked UP. That is the active connection. Then use the first inet address listed for that interface. If both eth0 and wlan0 are UP, you are connected to two networks at once, and you have a different IP on each one.

To see which IP your computer is actually using to reach the internet, open a terminal and type ip route. Look for the line that starts with "default via" — that tells you which interface is your main connection. The IP address on that interface is the one the outside world sees.

Checking your IP address from outside your network

The IP address you see with ip addr is your local IP — it only works on your home or office network. If you need to know your public IP (the one the internet sees), you have to ask a server outside your network.

From the terminal, type curl ifconfig.me or curl icanhazip.com. Either command will print your public IP address. This is useful if you need to connect to your Linux machine from outside your home network, or if you are troubleshooting a connection problem and need to know what address you are actually using on the internet.

Your public IP is usually different from your local IP because your router translates between them. Your router has the public IP, and it forwards traffic to your local IP inside your network. This is why you need both numbers for different purposes.

Saving your IP address to a file

If you need to keep a record of your IP address, you can save it to a text file. Type ip addr > myip.txt and press Enter. This creates a file called myip.txt in your current folder with the full output. You can open it later with any text editor.

To save just your IP addresses without all the extra information, type hostname -I > myip.txt instead. This creates a simpler file with only the numbers.

You can also email it to yourself or copy it to another machine. Type ip addr | mail -s "My IP" yourname@example.com to send the output directly to your email (if your system has mail set up).

Frequently Asked Questions

Why do I see multiple IP addresses when I run ip addr?

Each network interface gets its own IP address. If you have WiFi and ethernet both connected, you will see one IP for each. The "lo" address is your loopback and is not a real network address. Look for the interface you are actually using — usually wlan0 for WiFi or eth0 for wired.

What is the difference between inet and inet6?

inet is IPv4, the older standard that looks like 192.168.1.100. inet6 is IPv6, the newer standard that looks like fe80::1. Most home networks still use IPv4, but many systems support both. You can use either one to connect to your machine, depending on what your network supports.

Is my local IP address the same as my public IP?

No. Your local IP (from ip addr) only works inside your home or office network. Your public IP is what the internet sees, and you can find it with curl ifconfig.me. Your router translates between them, so they are usually different numbers.

Can I change my IP address from the terminal?

Yes, but it requires editing network configuration files or using tools like nmcli or netplan, depending on your Linux version. For most users, it is easier to change the IP through your router's settings or by restarting your connection. If you need a permanent change, contact your network administrator or your internet provider.

What if ip addr does not work on my system?

Try ifconfig or hostname -I instead. Older Linux systems use ifconfig, while newer ones prefer ip. If neither works, your system may not have networking tools installed, or you may need to run the command with sudo for permission.