Taking file with ip ranges, each on it's own line like:
cat ipranges.txt
213.87.86.160-213.87.86.193
213.87.87.0-213.87.88.255
91.135.210.0-91.135.210.255
command returns deaggregated ip ranges using ipcalc deaggregate feature like that:
213.87.86.160/27
213.87.86.192/31
213.87.87.0/24
213.87.88.0/24
91.135.210.0/24
Useful for configuring nginx geo module
Show Sample Output
a bit shorter, parenthesis not needed but added for clarity Show Sample Output
prips usage: prips [options] -c print range in CIDR notation -d set the delimiter 'x' where 0 =< x =< 255 -h display this help message and exit -f set the format of addresses (hex, dec, or dot) -i set the increment to 'x' -e e.g. -e ..4. will not print 192.168.4.[0-255] Report bugs to Peter Pentchev
Displays live hosts on the same network as the local machine with their hostnames and IP addresses.
This command is IPv6 and multiple network adapter safe and does not rely on awk or sed, however it requires the "nmap" package installed. Might not work on OSX.
Example alias for shell startup file:
alias livehosts='nmap -sP "$(ip -4 -o route get 1 | cut -d " " -f 7)"/24 | grep report | cut -d " " -f 5-'
Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for: