Simple Ping Sweeper for Linux

This script is a simple ping sweeper to identify hosts reachable from a system. The intent here is something simple and dirty that can quickly be manually created in the event I can’t use the normal tools and scripts. Obviously things like nmap would be much better here, but sometimes those tools won’t be available and you won’t be able to transfer them over.


#Usage: Takes first 3 octects of network to sweep
#Example: 192.168.1

if [ “$1” == “” ] #space  between brackets is important
  echo “You forgot an ip address"
  echo “Syntax:”
  echo “Usage: Takes first 3 octects of network to sweep”
  echo “Example: 192.168.1”
  for ip in `seq 1 254`; do
    ping -c 1 $1.$ip | grep “64 bytes” | cut -d “ ” -f 4 | tr -d “:” &

Leave a Reply