top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

You have an IP address in your network how will you find hostname and vice versa?

+1 vote
413 views
You have an IP address in your network how will you find hostname and vice versa?
posted Oct 14, 2015 by Mohammed Hussain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

IP to Hostname
To find a hostname in your local network by IP address

nmblookup -A <ip>

To find a hostname on the internet

host <ip>

Alternate method

install nbtscan (apt-get install nbtscan or yum install nbtscan)
nbtscan <ip>

Hostname To IP
Use host command i.e.

host queryhome.com
queryhome.com has address x.x.x.x
answer Oct 15, 2015 by Salil Agrawal
Similar Questions
+1 vote

Let's say I want to compare two csv files: file A and file B. They are both similarly built - the first column has product IDs (one product per row) and the columns provide some stats about the products such as sales in # and $.

I want to compare these files - see which product IDs appear in the first column of file A and not in B, and which in B and not A.
Finally, it would be very great if the result could be written into two new CSV files - one product ID per row in the first column. (no other data in the other columns needed)

This is the script I tried:

import csv

#open CSV's and read first column with product IDs into variables pointing to lists
A = [line.split(',')[0] for line in open('Afile.csv')]
B = [line.split(',')[0] for line in open('Bfile.csv')]

#create variables pointing to lists with unique product IDs in A and B respectively 
inAnotB = list(set(A)-set(B))
inBnotA = list(set(B)-set(A))

print inAnotB
print inBnotA

c = csv.writer(open("inAnotB.csv", "wb"))
c.writerow([inAnotB])

d = csv.writer(open("inBnotA.csv", "wb"))
d.writerow([inBnotA])

print "done!" 

But it doesn't produce the required results.
It prints IDs in this format:

247158132n

and nothing to the csv files.

...