Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

DNS lookup

Several DNS lookup utilities provide name and IP address resolution from the command line. The host and nslookup commands are two commonly installed utilities.

The host command lists all of the IP addresses attached to a domain name:

$ host google.com 
google.com has address 64.233.181.105 
google.com has address 64.233.181.99 
google.com has address 64.233.181.147 
google.com has address 64.233.181.106 
google.com has address 64.233.181.103 
google.com has address 64.233.181.104 

The nslookup command maps names to IP addresses and will also map IP addresses to names:

$ nslookup google.com 
Server:    8.8.8.8 
Address:  8.8.8.8#53 
 
Non-authoritative answer: 
Name:  google.com 
Address: 64.233.181.105 
Name:  google.com 
Address: 64.233.181.99
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985