We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

cczona on 04/29/08


Tagged

cli DNS dig


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

srinivasga


Dig, without the cruft


Published in: Bash 


URL: http://fosswire.com/tag/cli/page/18/

If you pass the +short option to dig, it will give you a really short and sweet answer - just the IP address.

$ dig fosswire.com +short
208.113.149.33
  1. $ dig fosswire.com +short
  2.  
  3. 208.113.149.33
  4.  
  5.  
  6.  
  7. $ dig fosswire.com
  8.  
  9. ; <<>> DiG 9.4.1-P1 <<>> fosswire
  10. ;; global options: printcmd
  11. ;; Got answer:
  12. ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 27325
  13. ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
  14.  
  15. ;; QUESTION SECTION:
  16. ;fosswire. IN A
  17.  
  18. ;; Query time: 86 msec
  19. ;; SERVER: 10.0.1.1#53(10.0.1.1)
  20. ;; WHEN: Tue Apr 29 01:03:13 2008
  21. ;; MSG SIZE rcvd: 26

Report this snippet 

You need to login to post a comment.