How can I write a Linux bash script that tells me which computers are ON in my LAN?

前端 未结 16 1536
攒了一身酷
攒了一身酷 2020-12-12 11:59

How can I write a Linux Bash script that tells me which computers are ON in my LAN?

It would help if I could give it a range of IP addresses as input.

16条回答
  •  -上瘾入骨i
    2020-12-12 13:03

    In the real world, you could use nmap to get what you want.

    nmap -sn 10.1.1.1-255
    

    This will ping all the addresses in the range 10.1.1.1 to 10.1.1.255 and let you know which ones answer.

    Of course, if you in fact want to do this as a bash exercise, you could run ping for each address and parse the output, but that's a whole other story.

提交回复
热议问题