OSXFAQ Mac OS X UNIX Tip-of-the-Day

Week 103 - Unix Commands Reference III (28 March 2005)
by
Adrian Mayo - Editor, OSXFAQ
Friday - Commands for Network Information
hostname ... set or display the hostname
Option -s to display hostname without domain name part.
hostname is normally set automatically from /etc/hostconfig
ifconfig ... configure network interfaces
Without any parameters displays the configuration for all network interfaces
For example, 'ifconfig en0 down' then 'ifconfig en0 up' resets en0.
ipconfig ...set the IP mode of an interface
Usage is:
ipconfig set <interface> BOOTP|MANUAL|DCHP|NONE|INFORM
route ... maintain network routing tables
The routine information for a destination can be queried with:
route -v get apple.com
route -v get localhost
arp ... maintain address resolution protocol tables
The tables map IP addresses to Ethernet addresses
Option -a to display all table entries
service ... start and stop xinetd services
option --list to list the services
The possible commands are 'start' and 'stop'.
netstat ... display the network status
Shows the state of all network connections (sockets)
Option -I to specify a particular interface like en0
tcpdump ... dump tcp activity
Option -v, -vv, -vvv to increase verbosity of reports
For example, to listen to network traffic with apple.com use 'sudo tcpdump -vvv host apple.com'
tcpflow ... dump and analyse tcp activity
Like tcpdump but not included with OS X. Available from ports such as Fink.
nslookup ... interactive domain name query (DNS)
dig ... look up DNS information
Works both as a one-off command or interactively.
host ... look up DNS information
Option -t to specify the type of DNS record to look up.
For example 'host -t ns apple.com' to fetch name server records for apple.com. 't can also be 'mx', 'a', 'soa', etc.
Option -a to request all DNS information for the host
(See tips week 43)
named ... DNS daemon
This runs a DNS service
ntpd ... network time protocol daemon
This runs an ntp server
ntpq ... query ntp time server
ntptimeset ... set network time
If you want to learn more about Mac OS X Unix visit the Learning Center
click.
- For beginners: Mac OS X Unix Tutorials
- For detailed information on specific topics: Advanced Unix
- For OS X in gereral: Mac OS X Tutorials
|