Learn how to check nic status in Linux and how to check network port status in Linux. Here is the Linux command to check network connection.
How to check NIC status in Linux
You must know how to check the ethernet port status in Linux as it is one of the best ways to check if nic card is faulty in Linux.
Open the terminal and run ifconfig -a command to check the network interface. It will display the information about all the network interfaces on the current system.
Ifconfig is used to configure the kernel-resident network interfaces. It is usually needed when debugging is needed. Note that when no arguments are given, ifconfig command displays the status of the currently active interfaces. When you give a single interface argument with the command, it displays the status of the given interface only.
When you give the argument -a it displays all interfaces which are currently available, even if down. If you want to display a short list (like netstat -i), use -s argument with the command.
You can also use ip -a or ip addr get information on all the network interfaces on your system.
Using netstat to Display Network Info
The netstat (network statistics) command is used to display information about network. If the command is not installed, run the command $ sudo apt-get install net-tools to install the netstat tool.
If you want to find which process is running on specific port number. For example the following command will display which process is running on port number 80 on the system:
$ sudo netstat -ltnp | grep -w ':80'
You can also use the lsof (List of Open Files) command to listen all the open files on your Linux Ubuntu system.