How to return only interface names when listing all installed network interfaces in a Linux box.
jason@jason-Lenovo-H50-55:~/Documents$ ip link | grep -Po "(?<=^\d: |^\d\d:)[^:]+(?=:)" lo eth0 wlan0 |
This is very useful to get a listing of all networking interfaces for use in a script.
Do it this way using ifconfig.
jason@jason-Lenovo-H50-55:~/Documents$ ifconfig | grep -oP '^[^ ]*' eth0 lo wlan0 |
This is great if the user is writing a script and wishes to get a listing of all network interfaces.
This is a final way of listing all interface names. This could be used in a C program with execve().
jason@jason-Lenovo-H50-55:~/Documents$ ls -1 /sys/class/net eth0 lo wlan0 |
This is very useful information to any Linux user. I hope someone like this info. I was looking for a long while on how to do this.