The `ip link show` command, available in more recent versions of Linux that support the `ip` command, provides information about network interfaces and their respective states.
Executing `ip link show` yields extensive details regarding the interface, including its MAC address, operational state, IP address, and additional relevant information.
The command below identifies the names of interfaces currently in either an UP or DOWN state.
The output is piped to `grep` to filter and display only the state alongside the interface name.
To display interfaces in a DOWN state, use the following command:
```ip command:
echo "Interface on DOWN state: $(ip link show | grep "state DOWN" | grep -oP '^[0-9]+:\s+\K\S+' | cut -d: -f1)"
```
To display interfaces in an UP state, the command is:
```ip command:
echo "Interface on UP state: $(ip link show | grep "state UP" | grep -oP '^[0-9]+:\s+\K\S+' | cut -d: -f1)"
```
The following command lists all MAC addresses of the interfaces present on the device or server:
```ip command:
ip link show | grep -oP '^[0-9]+:\s+\K\S+' | cut -d: -f1 | xargs -I{} ip link show {} | grep -oP 'ether\s+\K\S+'
```
A sample image illustrating the output of the aforementioned commands is provided below:
'ip -s link' command can be used to keep track rx and tx packets which is useful to check if the system or server is not working as it should be.
Output will show dropped, error, number of packets received or transmitted.
Sample output of 'ip -s link' command:
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes packets errors dropped overrun mcast
3612 29 0 0 0 0
TX: bytes packets errors dropped carrier collsns
3612 29 0 0 0 0
2: eth0: mtu 1400 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:18:7d:fe:b2:7c brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
126899030 114099 0 0 0 53
TX: bytes packets errors dropped carrier collsns
2391880 34766 0 0 0 0
Always remember the Presence of God on yourself, He's with you all the time through the power and grace of the Holy Spirit.
Executing `ip link show` yields extensive details regarding the interface, including its MAC address, operational state, IP address, and additional relevant information.
The command below identifies the names of interfaces currently in either an UP or DOWN state.
The output is piped to `grep` to filter and display only the state alongside the interface name.
To display interfaces in a DOWN state, use the following command:
```ip command:
echo "Interface on DOWN state: $(ip link show | grep "state DOWN" | grep -oP '^[0-9]+:\s+\K\S+' | cut -d: -f1)"
```
To display interfaces in an UP state, the command is:
```ip command:
echo "Interface on UP state: $(ip link show | grep "state UP" | grep -oP '^[0-9]+:\s+\K\S+' | cut -d: -f1)"
```
The following command lists all MAC addresses of the interfaces present on the device or server:
```ip command:
ip link show | grep -oP '^[0-9]+:\s+\K\S+' | cut -d: -f1 | xargs -I{} ip link show {} | grep -oP 'ether\s+\K\S+'
```
A sample image illustrating the output of the aforementioned commands is provided below:
'ip -s link' command can be used to keep track rx and tx packets which is useful to check if the system or server is not working as it should be.
Output will show dropped, error, number of packets received or transmitted.
Sample output of 'ip -s link' command:
1: lo:
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
RX: bytes packets errors dropped overrun mcast
3612 29 0 0 0 0
TX: bytes packets errors dropped carrier collsns
3612 29 0 0 0 0
2: eth0:
link/ether 00:18:7d:fe:b2:7c brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
126899030 114099 0 0 0 53
TX: bytes packets errors dropped carrier collsns
2391880 34766 0 0 0 0
Always remember the Presence of God on yourself, He's with you all the time through the power and grace of the Holy Spirit.
Comments
Post a Comment