Newer Linux distros have the ip command rather than ifconfig for getting network interface information and for managing them from the Linux command line.
Here is a quick guide on how to use this command from the Linux terminal:
To show network information for all the interfaces, type:
This will list all the network interfaces sequentially along with their status and other network details.
To get the information for a specific interface like ethernet or wireless, the command is:
To find a list of all the network interfaces that are currently up:
Similarly, you can also directly enable and disable network interfaces with the ip command (just like the ifconfig up/down commands):
sudo ip link set interfacename down
This will enable and disable the interfaces. You can first check the interfaces using the ip addr show command and then use the link parameters.
Other than that, you can also add static IP address to a particular interface. To do that:
So to add a static IP 192.168.0.20 / 255.255.255.0 to the ethernet interface eth1, the command will be:
For deleting the static IP:
The exact interface name will vary and can be found using the ip addr show command.
Also, to get the IPv4 and IPv6 details, the command is:
ip -6 a
Here is a quick reference table for managing network properties from the Linux terminal with the ip command:
You can also use the man ip command to know about other different parameters and functions.
All done.