Parameter | Description |
---|---|
ifconfig |
Command to display network interface configuration, including Ethernet interfaces. |
grep ether |
Filters the output of ifconfig to only include lines containing the word “ether”. |
awk '{print $2}' |
Extracts the second column from each line of the filtered output (Ethernet addresses). |
This script, when executed, will retrieve the Ethernet addresses (MAC addresses) of the network interfaces on the system.
The |
character in Unix-like systems is known as the pipe symbol, and it’s used to connect the output of one command to the input of another.
So, when you run ifconfig | grep ether | awk '{print $2}'
, you’re essentially:
- Fetching the network interface configuration.
- Filtering out lines that don’t contain Ethernet interface information.
- Extracting and printing the MAC addresses of the Ethernet interfaces.