Linux Commands

Display TCP/IP Information Associated with Every Interface on the Device

Understanding your network and interfaces is essential. Through it, you will know what route your traffic takes on your network. Besides, you will quickly know how best to configure your interfaces to maximize and secure your network.

A common concern people have is knowing how they can display the TCP/IP information that is associated with every interface on the device. If you have the same concern, we will help clear the doubts by detailing which command you can use and what output you will get. Read on!

Understanding TCP/IP

TCP/IP is a short term for Transmission Control Protocol/Internet Protocol and it represents a bundle of communication protocols that are required to connect the networking devices on the internet. TCP/IP protocols create the abstraction between networking devices or internet applications and the routing of packets.

It is the TCP/IP suite that defines how the data will get exchanged by ensuring that it offers an end-to-end communication for the packets. TCP handles different applications on the internet, allowing them to create the communication channels over the internet, while IP defines the routing for the packets to guarantee that the communication occurs. Each application or device relies on the routing table that is defined by IP to determine how the packets will flow.

How to Display the TCP/IP Information Associated with Every Interface on the Device

Linux systems offer an easy way for the users to display the TCP/IP information for their interfaces. The Linux “ifconfig” command helps with viewing all the TCP/IP information for your network interfaces. The “ifconfig” tool comes as part of the net-tools utility and it has numerous options that you can use to define how you want to display the different TCP/IP information.

The following are the different examples on how you can display the TCP/IP information associated with every interface on the network:

Example 1: Display All Active Network Interfaces

When you have different network interfaces, you can display those that are currently active to check their information. For that, run the “ifconfig” command with no options.

$ ifconfig

You will get an output that gives the TCP/IP information for all the active interfaces.

Example 2: Specify a Target Interface

Suppose you only want to view the TCP/IP information for a particular interface. You can quickly specify the interface, and the following “ifconfig” command will display its information.

For instance, if you have the “wlo1” interface, run the following command:

$ ifconfig wlo1

The previous option helps narrow down the information about the interfaces on your device by focusing on the specified interface.

Example 3: Display a Summary for All Interfaces

It’s also possible to display a minimized output for all the active interfaces. The following command simplifies how you view all the available information about your interfaces by displaying a shortlist of any active interfaces:

$ ifconfig -s

The following image shows what the shortened output for the active interfaces look like:

Example 4: Display the TCP/IP for All Interfaces

Not all interfaces may be up at a go. When you have inactive interfaces, it’s also possible to display their TCP/IP information. For that, we add the -a option to dictate that the displayed information should be for all interfaces.

$ ifconfig -a

Since we don’t have any inactive interfaces for this case, our output will appear as the one that we got earlier. Yours may be different.

Example 5: Display the IP Addresses for All Interfaces

To quickly get the IP addresses associated with any of the networking interfaces, use the “grep” command and specify it to match the inet option. Doing so gives the IP addresses.

$ ifconfig | grep inet

Your output will appear almost similar to the one in the following:

If you want to display the TCP/IP netmask for the interfaces, adding the “netmask” command ensures that the output only matches the lines that contain the netmask.

You can also specify the “errors” in the “grep” command to output all the lines that represent a transmission error such as collisions.

Here’s the command for that:

$ ifconfig | grep errors

Our output is as follows:

Those are the different examples on how you can display the TCP/IP information.

Conclusion

This post discussed what TCP/IP means. Moreover, we’ve given examples on how you can display the different information that are vital to displaying the TCP/IP information for different network interfaces. Have fun!

About the author

Denis Kariuki

Denis is a Computer Scientist with a passion for Networking and Cyber Security. I love the terminal, and using Linux is a hobby. I am passionate about sharing tips and ideas about Linux and computing.