27.08.2015 Views

Advanced Bash−Scripting Guide

Advanced Bash-Scripting Guide - Nicku.org

Advanced Bash-Scripting Guide - Nicku.org

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Advanced</strong> <strong>Bash−Scripting</strong> <strong>Guide</strong><br />

filter the output of a script.<br />

12.6. Communications Commands<br />

Certain of the following commands find use in chasing spammers, as well as in network data transfer and<br />

analysis.<br />

Information and Statistics<br />

host<br />

Searches for information about an Internet host by name or IP address, using DNS.<br />

bash$ host surfacemail.com<br />

surfacemail.com. has address 202.92.42.236<br />

ipcalc<br />

Carries out IP address lookups. With the −h option, ipcalc does a reverse DNS lookup, finding the<br />

name of the host (server) from the IP address.<br />

bash$ ipcalc −h 202.92.42.236<br />

HOSTNAME=surfacemail.com<br />

nslookup<br />

Do an Internet "name server lookup" on a host by IP address. This is essentially equivalent to ipcalc<br />

−h or dig −x . The command may be run either interactively or noninteractively, i.e., from within a<br />

script.<br />

The nslookup command has allegedly been "deprecated", but it still has its uses.<br />

bash$ nslookup −sil 66.97.104.180<br />

nslookup kuhleersparnis.ch<br />

Server: 135.116.137.2<br />

Address: 135.116.137.2#53<br />

Non−authoritative answer:<br />

Name: kuhleersparnis.ch<br />

dig<br />

Similar to nslookup, do an Internet "name server lookup" on a host. May be run either interactively or<br />

noninteractively, i.e., from within a script.<br />

Compare the output of dig −x with ipcalc −h and nslookup.<br />

bash$ dig −x 81.9.6.2<br />

;; Got answer:<br />

;; −>>HEADER

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!