Skip to content

Instantly share code, notes, and snippets.

@eiiches
Created February 27, 2011 07:53
Show Gist options
  • Select an option

  • Save eiiches/845995 to your computer and use it in GitHub Desktop.

Select an option

Save eiiches/845995 to your computer and use it in GitHub Desktop.
Search hosts available for SSH.
#!/bin/bash
grep 'ant\|bee\|cat\|dog\|emu' /etc/hosts | while read ip host; do
nc -w 1 -z "$ip" 22 > /dev/null && echo "$host" &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment