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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

;; Query time: 537 msec<br />

;; SERVER: 135.116.137.2#53(135.116.137.2)<br />

;; WHEN: Wed Jun 26 08:35:24 2002<br />

;; MSG SIZE rcvd: 91<br />

traceroute<br />

Trace the route taken by packets sent to a remote host. This command works within a LAN, WAN, or<br />

over the Internet. The remote host may be specified by an IP address. The output of this command<br />

may be filtered by grep or sed in a pipe.<br />

bash$ traceroute 81.9.6.2<br />

traceroute to 81.9.6.2 (81.9.6.2), 30 hops max, 38 byte packets<br />

1 tc43.xjbnnbrb.com (136.30.178.8) 191.303 ms 179.400 ms 179.767 ms<br />

2 or0.xjbnnbrb.com (136.30.178.1) 179.536 ms 179.534 ms 169.685 ms<br />

3 192.168.11.101 (192.168.11.101) 189.471 ms 189.556 ms *<br />

...<br />

ping<br />

Broadcast an "ICMP ECHO_REQUEST" packet to other machines, either on a local or remote<br />

network. This is a diagnostic tool for testing network connections, and it should be used with caution.<br />

A successful ping returns an exit status of 0. This can be tested for in a script.<br />

bash$ ping localhost<br />

PING localhost.localdomain (127.0.0.1) from 127.0.0.1 : 56(84) bytes of data.<br />

Warning: time of day goes back, taking countermeasures.<br />

64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=0 ttl=255 time=709 usec<br />

64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=255 time=286 usec<br />

−−− localhost.localdomain ping statistics −−−<br />

2 packets transmitted, 2 packets received, 0% packet loss<br />

round−trip min/avg/max/mdev = 0.286/0.497/0.709/0.212 ms<br />

whois<br />

finger<br />

Perform a DNS (Domain Name System) lookup. The −h option permits specifying which whois<br />

server to query. See Example 4−6.<br />

Retrieve information about users on a network. Optionally, this command can display a user's<br />

~/.plan, ~/.project, and ~/.forward files, if present.<br />

bash$ finger<br />

Login Name Tty Idle Login Time Office Office Phone<br />

bozo Bozo Bozeman tty1 8 Jun 25 16:59<br />

bozo Bozo Bozeman ttyp0 Jun 25 16:59<br />

bozo Bozo Bozeman ttyp1 Jun 25 17:07<br />

bash$ finger bozo<br />

Login: bozo<br />

Name: Bozo Bozeman<br />

Directory: /home/bozo<br />

Shell: /bin/bash<br />

On since Fri Aug 31 20:13 (MST) on tty1 1 hour 38 minutes idle<br />

On since Fri Aug 31 20:13 (MST) on pts/0 12 seconds idle<br />

On since Fri Aug 31 20:13 (MST) on pts/1<br />

On since Fri Aug 31 20:31 (MST) on pts/2 1 hour 16 minutes idle<br />

No mail.<br />

Chapter 12. External Filters, Programs and Commands 192

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

Saved successfully!

Ooh no, something went wrong!