for i in $(seq 1 254); do ping -t 1 -c 1 192.168.1.$i >> result.txt done grep time= result.txt rm -fr result.txt