Skip to content

Instantly share code, notes, and snippets.

@Forever-Young
Last active December 20, 2015 06:48
Show Gist options
  • Save Forever-Young/6088173 to your computer and use it in GitHub Desktop.
Save Forever-Young/6088173 to your computer and use it in GitHub Desktop.
# get current network, eg. 192.168.1.0/24
ip addr show dev $(ip route | grep default | cut -d" " -f5) | grep inet | xargs echo | cut -d" " -f2 | xargs ipcalc -n -b | grep Network | xargs echo | cut -d" " -f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment