Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created December 29, 2011 03:00
Show Gist options
  • Select an option

  • Save cowboy/1531434 to your computer and use it in GitHub Desktop.

Select an option

Save cowboy/1531434 to your computer and use it in GitHub Desktop.
I want to know what machines I have on my network. Is there a better (also faster) way than to ping machines 192.168.0.1 - 192.168.0.255?
#!/bin/bash
for oct in {1..254}; do
ip="192.168.0.$oct"
echo -en "\033[s$ip"
ping -c 1 -t 1 "$ip" >/dev/null 2>&1 && echo || echo -en "\033[1K\033[u"
done
@cowboy
Copy link
Copy Markdown
Author

cowboy commented Dec 29, 2011

Thanks. Since writing this snippet, I did a little research and came up with a shell script wrapper around nmap:

https://github.com/cowboy/dotfiles/blob/master/bin/scan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment