Linux is an incredibly powerful operating system for both servers and desktops. For the most part, anyone using Linux on a desktop could go their entire life without touching the command line.
However, there are a lot of very handy tools from within the terminal window. Take, for instance, identifying your IP address.
Let’s say you’re using a desktop version of Linux, complete with a desktop environment and all the features that come with it. If you have that desktop configured for DHCP, your machine will be given an IP address from a server or router on your network.
Even with a GUI, you might find it challenging to locate the server’s IP address. If that address is configured as static, or manual, users can view it by opening the distribution’s network configuration tool and checking either the IPv4 or IPv6 address.
Those DHCP addresses can be tricky to locate with a GUI. From the command line, however, those IP addresses are easy to discern.
Previously, the command used to find your IP address was ifconfig, which was part of the net-tools application. The command that replaced ifconfig is ip, which is responsible for showing and manipulating routing and networking devices, as well as interfaces and tunnels.
The ip command has several options, but the only one you need to use is a, which is short for all. You can also substitute either address or addr, which will generate the same information.
To list the IP addresses associated with your network interfaces, the command would be the following.
The output would include something like this.
As you can see, there’s more information to be gleaned from a single entry.
Let’s say, however, you want to list the information for only a single interface. We’ll stick with our wlo1 example. To do this, we can use two options:
To view only the information for the wlo1 interface, that command would be the following.
The output of that command might still contain more information than you need, as it will show both IPv4 and IPv6 information. If you only need to see your IPv4 address, the command would be the following.
If you only need to see the IPv6 address, the command would be the following.
The formerly used command, ifconfig, will still work for users, but it is deprecated. Regardless, users can still employ the command to find IP addresses in some cases.
This command was used for years, but was eventually deprecated because the authors of the command simply stopped developing it.
However, ifconfig is still available. Some users might find its output easier to read than that of the command that replaced it. But since ifconfig has been deprecated, use it sparingly.
First off, you’ll have to install it. If you’re using a RHEL-based distribution such as Fedora, the required software is already installed. If you’re using an Ubuntu-based distribution, you’ll need to install net-tools with the following command.
Once the software has been installed, you can locate your IP address with the following command.
The command will generate quite a bit of information, especially if you have multiple network interfaces or containerized applications deployed. The relevant bits of information for your IP address will be within the following two lines.
As you can see in the output, we have a wireless network interface, wlo1, that has the assigned IP address 192.168.1.62.
If you have numerous network cards or deployed containers, you might want to limit the output of the command to a single interface. For instance, you can list out only the details for the wlo1 interface with the following command.
The ifconfig and ip commands are only good for locating private IP addresses.
Users who need to locate a public IP address — the address that is seen by the outside world — must employ a command such as curl in the following example.
This command will only list out the public-facing IP address for the network.
The security product attempts to ferret out threats that originate from apps and services then assists the enterprise with an …
With more apps and credentials to juggle, users can get blocked from their accounts after too many login attempts. Learn to use …
These offerings provide portals to avoid security issues and other stumbling blocks that hamper organizations from providing more…
Open source PaaS is a good option for developers who want control over application hosting and simplified app deployment, but not…
PaaS is a good option for developers who want control over application hosting and simplified app deployment, but not all PaaS …
It is challenging to find the right balance between performance, availability and cost. Learn how to enable and apply AWS Compute…
RackTop Systems and Seagate are offering more in turnkey storage appliances and private cloud integration, combining security …
Microsoft’s interest in Fungible DPUs might be a play for its cloud computing platform Azure.
Cloud Flex Storage by VMware provides to customers of VMware Cloud on AWS a managed storage service with cloud console …
All Rights Reserved, Copyright 2000 – 2022, TechTarget
Do Not Sell or Share My Personal Information