PDF Print E-mail
How to do a ping sweep in Linux


Sometimes it can be handy to 'see' what is around you on a network, for instance when you're using DHCP on a network and you want to find which addresses are already taken. Or you want to see whether specific machines are up and running... Of course there are various tools you can install or use, but there are times that you just can't reach for the right tool(s)... You don't want to do a ping sweep for nothing ;-)...

Of course there is a way of ping sweeping from the command line :-) By simply using the 'FOR', 'PIPE' and 'GREP' commands in a clever way.


for i in {1..254}; do ping -c 1 -W 1 192.168.1.$i | grep 'from'; done


Naturally you can stop the ping sweep by entering Ctrl+z


Suggestions for improving this article are welcome, please let me know and This e-mail address is being protected from spambots. You need JavaScript enabled to view it .


Sponsored Links