LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-10-2013, 12:41 AM   #1
kohshan99
Member
 
Registered: Sep 2012
Posts: 53

Rep: Reputation: Disabled
Question How to find ip's of all computers in my lan from command prompt


how to see all my lan ip's in command prompt

i know that ifconfig

it show only my system ip number only
in my lan overall 20 systems are there how to see all 20 systems lan in cmd mode
 
Old 10-10-2013, 12:52 AM   #2
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,299

Rep: Reputation: 222Reputation: 222Reputation: 222
check out this link: http://www.cyberciti.biz/faq/mapping...-ping-command/

Quote:
Linux / UNIX one liner to ping all hosts on the LAN

Type the following command, enter:
$ for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip>/dev/null; [ $? -eq 0 ] && echo "192.168.1.$ip UP" || : ; done
 
Old 10-10-2013, 12:54 AM   #3
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 525

Rep: Reputation: 141Reputation: 141
To see IP address of all the hosts that are up for a particular subnet
Code:
# nmap -sn 192.168.1.0/24
To view hostname of linux machine
Code:
# host 192.168.1.74
To view hostname (netbios) of windows machine
Code:
# nbtscan 192.168.1.75
 
Old 10-10-2013, 01:01 AM   #4
mddnix
Member
 
Registered: Mar 2013
Distribution: Redhat, Ubuntu
Posts: 525

Rep: Reputation: 141Reputation: 141
@JJJCR

Even better is to use brace expansions. http://www.linuxquestions.org/questi...0/#post4977082
 
Old 10-10-2013, 01:07 AM   #5
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,299

Rep: Reputation: 222Reputation: 222Reputation: 222
Cool

Quote:
Originally Posted by mddesai View Post
@JJJCR

Even better is to use brace expansions. http://www.linuxquestions.org/questi...0/#post4977082
@mddesai

from your link that you posted, script is good and just add a command to send the output to a file would be better:

Quote:
for ip in 192.168.1.{1..254}; do

if ping -c 1 "$ip" >/dev/null ; then
echo "$ip UP" >> online.txt
else
echo "$ip DOWN" >> offline.txt
fi

done

Last edited by JJJCR; 10-10-2013 at 01:08 AM. Reason: edit
 
Old 10-10-2013, 04:08 AM   #6
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,254

Rep: Reputation: 314Reputation: 314Reputation: 314Reputation: 314
"ping" (ICMP) often is blocked. You can use "arpwatch", it will store connections between IP and MAC in file, but is not work immediately, it need to wait for ARP traffic from every machine.
 
  


Reply

Tags
cmd, ifconfig, lan, linux, ubuntu 12.04


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command to list the ip address of working computers on LAN satimis Linux - General 4 05-29-2010 08:58 AM
How to Add another IP on the same LAN interface using command prompt deepak_message Linux - Server 6 05-01-2009 05:01 AM
Can not find mysql command prompt Thaidog Linux - Software 4 10-03-2008 03:35 PM
acces of computers in lan kantor_98 Linux - Newbie 4 06-14-2007 08:19 AM
KDE Lan Browser doesn't display available LAN computers dance2die Linux - Newbie 2 01-16-2005 08:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration