Last active
February 18, 2019 22:32
-
-
Save nilox94/27f372c6d4a596754643b4c98202fc86 to your computer and use it in GitHub Desktop.
Commands to list network interfaces and specifically wired and wireless interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function net-interfaces(){ | |
echo `ip -c=never addr | gawk 'match($0, /[[:digit:]]+: ([[:alnum:]]+):/, m) { print m[1] }'` | |
} | |
function wireless() { | |
echo `ip -c=never addr | gawk 'match($0, /[[:digit:]]+: (w[[:alnum:]]+):/, m) { print m[1] }'` | |
} | |
function ethernet() { | |
echo `ip -c=never addr | gawk 'match($0, /[[:digit:]]+: (e[[:alnum:]]+):/, m) { print m[1] }'` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment