Software & AppsOperating SystemLinux

How To List Installed Network Cards on Ubuntu with a Terminal Command

Ubuntu 1

In this article, we will cover how to list all installed network cards on an Ubuntu system using various terminal commands. This can be a handy tool for system administrators and users alike when troubleshooting network issues or configuring network settings.

Quick Answer

To list installed network cards on Ubuntu using a terminal command, you can use various commands such as ip link show, netstat -i, ifconfig, iwconfig, lspci, cat /proc/net/dev, lshw -class network, and nmcli. Each command provides different levels of information about the network interfaces.

Opening the Terminal

First, you’ll need to open the terminal. You can do this by pressing Ctrl + Alt + T on your keyboard or by searching for ‘Terminal’ in your system’s application launcher.

Using the ip Command

The ip command is a powerful tool for managing network interfaces on a Linux system. To list all network interfaces, enter the following command:

ip link show

Alternatively, you can simply use:

ip link

Both commands will display the same result. The link parameter is used to display or manipulate routing, devices, policy routing, and tunnels.

Using the netstat Command

The netstat command is another useful tool for network troubleshooting. To list all network interfaces along with their statistics, use:

netstat -i

The -i option stands for interfaces. It displays a table of all network interfaces.

Using ifconfig and iwconfig Commands

To get additional information or details about a specific device, you can use the ifconfig command followed by the device name. For example:

ifconfig eth0

This command will display information about the Ethernet interface named ‘eth0’. Replace ‘eth0’ with the name of your interface.

Similarly, you can use the iwconfig command followed by the wireless device name to get information about wireless interfaces. For instance:

iwconfig wlp1s0

This will provide details about the wireless interface named ‘wlp1s0’. Replace ‘wlp1s0’ with the name of your wireless interface.

Using the lspci Command

Typing lspci in the terminal will list all PCI devices, including network cards. This command is useful when you need to identify hardware components in a system.

lspci

Using lspci with egrep Command

To specifically list network cards, you can use the lspci command piped with egrep:

lspci | egrep -i --color 'network|ethernet'

This command will highlight the word “Ethernet” if found and list all network cards available and installed. The egrep command is a version of grep that supports extended regular expressions.

Using /proc/net/dev File

To see physically installed but unconfigured network cards, you can use the following command in the terminal:

cat /proc/net/dev

This command will display the contents of the /proc/net/dev file, which contains information about network interfaces.

Using the lshw Command

For detailed hardware information, you can run the following command in the terminal:

sudo lshw -class network

This command will provide comprehensive details about the network hardware. The -class option is used to only show a certain class of hardware.

Using the nmcli Command

To view the current NetworkManager configuration, simply type nmcli in the terminal:

nmcli

This command will display the status of NetworkManager, devices, connections, and more.

Each of these commands offers a unique way to list installed network cards in Ubuntu using the terminal. Choose the one that suits your needs best. For more information about these commands, you can always refer to their man pages by typing man <command> in the terminal, replacing <command> with the name of the command.

Remember, understanding your system’s network interfaces is crucial for troubleshooting and configuring your network settings. These commands provide a solid foundation for doing just that.

How can I open the terminal in Ubuntu?

To open the terminal in Ubuntu, you can press Ctrl + Alt + T on your keyboard or search for ‘Terminal’ in your system’s application launcher.

What is the `ip` command used for?

The ip command is used for managing network interfaces on a Linux system. It can be used to display or manipulate routing, devices, policy routing, and tunnels.

How can I list all network interfaces using the `ip` command?

To list all network interfaces using the ip command, you can enter ip link show or simply ip link in the terminal.

What is the purpose of the `netstat` command?

The netstat command is a useful tool for network troubleshooting. It can be used to display network interfaces along with their statistics.

How do I use the `ifconfig` command to get information about a specific network device?

To get information about a specific network device using the ifconfig command, you can enter ifconfig <device_name>. For example, ifconfig eth0 will display information about the Ethernet interface named ‘eth0’.

What does the `lspci` command do?

The lspci command lists all PCI devices, including network cards. It is useful for identifying hardware components in a system.

How can I specifically list network cards using the `lspci` command?

To specifically list network cards using the lspci command, you can use lspci | egrep -i --color 'network|ethernet'. This command will highlight the word "Ethernet" if found and list all network cards available and installed.

How can I view physically installed but unconfigured network cards?

To view physically installed but unconfigured network cards, you can use the command cat /proc/net/dev in the terminal. This will display the contents of the /proc/net/dev file, which contains information about network interfaces.

What does the `lshw` command do?

The lshw command provides detailed hardware information. By running sudo lshw -class network in the terminal, you can obtain comprehensive details about the network hardware.

How can I view the current NetworkManager configuration?

To view the current NetworkManager configuration, you can simply type nmcli in the terminal. This command will display the status of NetworkManager, devices, connections, and more.

Leave a Comment

Your email address will not be published. Required fields are marked *