Friday, April 19, 2024
 Popular · Latest · Hot · Upcoming
5
rated 0 times [  5] [ 0]  / answers: 1 / hits: 5362  / 1 Year ago, wed, march 1, 2023, 1:09:22
sudo arp-scan --interface=eth0 --localnet


I know the above command works fine but it outputs everything like MAC address etc, etc.
But I need to find only IP addresses. Is it possible ?


More From » networking

 Answers
4

I just used awk,tail and head to achieve what you want:



sudo arp-scan --interface=eth0 --localnet| awk '{print $1}'|tail -n +3|head -n -2


this gives the output as



192.168.1.1
192.168.1.3


as I have only these two in my Lan.



Here awk '{print $1}' prints the ip address which is situated in the first column.
tail and head removes unnecessary stuff like the header and just shows the ip addresses.


[#26444] Friday, March 3, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
urnaetted

Total Points: 10
Total Questions: 113
Total Answers: 117

Location: Burundi
Member since Sat, Aug 21, 2021
3 Years ago
;