Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Why sometimes those two commands printing different results?

~$ dig facebook.com

; <<>> DiG 9.9.2-P1 <<>> facebook.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6625
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;facebook.com.          IN  A

;; ANSWER SECTION:
facebook.com.       205 IN  A   173.252.110.27

;; Query time: 291 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sun Oct  6 17:55:52 2013
;; MSG SIZE  rcvd: 57

~$ nslookup facebook.com
Server:     8.8.8.8
Address:    8.8.8.8#53

Non-authoritative answer:
Name:   facebook.com
Address: 10.10.34.34
share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

dig uses the OS resolver libraries. nslookup uses is own internal ones.

That is why ISC has been trying to get people to stop using nslookup for some time now. It causes confusion.

share|improve this answer
add comment

nslookup is a deprecated application and shouldn't really be used anymore.

The output even warns you of this:

Note: nslookup is deprecated and may be removed from future releases. Consider using the 'dig' or 'host' programs instead. Run nslookup with the '-sil[ent]' option to prevent this message from appearing.

excerpt from http://cr.yp.to/djbdns/nslookup.html

Do not use the ancient nslookup program. Whatever you're trying to do, there's a better way to do it. Even the BIND company, which maintains and distributes nslookup, says ``nslookup is deprecated and may be removed from future releases.''

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.