10 Linux DIG Command Examples for DNS Lookup--reference
;; AUTHORITY SECTION: ;; ADDITIONAL SECTION: ;; Query time: 160 msec 9. Bulk DNS Query Using dig -f (and command line)Query multiple websites using a data file:You can perform a bulk DNS query based on the data from a file. First,create a sample names.txt file that contains the website that you want to query. $ vi names.txt redhat.com centos.org Next,execute dig -f as shown below,which will perform DNS query for the websites listed in the names.txt file and display the output. $ dig -f names.txt +noall +answer redhat.com. 60 IN A 209.132.183.81 centos.org. 60 IN A 72.232.194.162 You can also combine record type with the -f option. The following example displays the MX records of multiple websites that are located in the names.txt file. $ dig -f names.txt MX +noall +answer redhat.com. 600 IN MX 10 mx2.redhat.com. redhat.com. 600 IN MX 5 mx1.redhat.com. centos.org. 3600 IN MX 10 mail.centos.org. Query multiple websites from dig command line:You can also query multiple websites from the dig command line as shown below. The following example queries MX record for redhat.com,and NS record for centos.org from the command line $ dig redhat.com mx +noall +answer centos.org ns +noall +answer 10. Use $HOME/.digrc File to Store Default dig OptionsIf you are always trying to view only the ANSWER section of the dig output,you don’t have to keep typing “+noall +answer” on your every dig command. Instead,add your dig options to the .digrc file as shown below. $ cat $HOME/.digrc +noall +answer Now anytime you execute dig command,it will always use +noall and +answer options by default. Now the dig command line became very simple and easy to read without you have to type those options every time. $ dig redhat.com redhat.com. 60 IN A 209.132.183.81 Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them,you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools,which will help you to become an effective Linux system administrator (编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |