From 2f0d5d65a87765875c3af71e258bd3e7b045b5eb Mon Sep 17 00:00:00 2001 From: Matt Tagg Date: Sun, 30 Oct 2016 18:28:11 -0700 Subject: [PATCH] .aliases: Add `ifactive` This lists only the active network interfaces. Handy for quickly chopping down the wall-of-text that is `ifconfig`. Credit to g.rocket over at https://unix.stackexchange.com/a/108048/6040. Closes #722. --- .aliases | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.aliases b/.aliases index 6ac614daa3c..16a55d83d23 100644 --- a/.aliases +++ b/.aliases @@ -61,6 +61,9 @@ alias ip="dig +short myip.opendns.com @resolver1.opendns.com" alias localip="ipconfig getifaddr en0" alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" +# Show active network interfaces +alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'" + # Flush Directory Service cache alias flush="dscacheutil -flushcache && killall -HUP mDNSResponder"