Skip to content

Instantly share code, notes, and snippets.

@blu3Alien
Created January 21, 2013 13:16
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save blu3Alien/4585961 to your computer and use it in GitHub Desktop.
Save blu3Alien/4585961 to your computer and use it in GitHub Desktop.
Shell script to scan a range of IP addresses. USAGE: ./pingscan 192.168.1.
#!/bin/sh
: ${1?"Usage: $0 ip subnet to scan. eg '192.168.1.'"}
subnet=$1
for addr in `seq 0 1 255 `; do
# ( echo $subnet$addr)
( ping -c 3 -t 5 $subnet$addr > /dev/null && echo $subnet$addr is Alive ) &
done
@ImadABID
Copy link

It's going to be better if you add this two lines of code at the end of the script.

wait
echo 'scan done'

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