Some Famous Unix Commands 1. Famous Unix directories and files include the following: / - called "slash", the top level directory /etc - directory containing system configuration files and management command, rhymes with Betsy /etc/hosts, /etc/services, /etc/protocols - famous network files /etc/resolv.conf, /etc/passwd, /etc/groups - more configuration files /bin, /usr/bin, /usr/local/bin, - directories of commands /sbin, /usr/sbin, /usr/local/sbin - superuser commands /home - user home directories 2. The man command (e.g. "man telnet") can be used to get more information on any of the following commands. 3. If you enter a command (e.g. ping) and receive the message "Command not found", it usually means that Unix is not looking in the directory that contains the command. If this happens, try "whereis ping", then "cd" to the correct directory and reenter the command. (For a permanent fix, edit the "path" statement in the file ".login"). 4. "telnet astro.temple.edu" - to log in to astro.temple.edu (very insecure). 5. "ssh stafford@astro.temple.edu" - to log in to stafford's account on astro.temple.edu using secure shell (encrypted password and data). 6. "ftp ftp.rfc-editor.org" - transfer a file from ftp.rfc-editor. Log in using account "anonymous" with your E-mail address as password. Try "dir", "cd in-notes", "ascii", "dir" again, and finally "get rfc791.txt". Use "bye" to exit ftp and "more rfc-index.txt" to read the document. (To do all of this automatically, enter the web address "ftp://ftp.rfc-editor.org/in-notes/rfc791.txt" in your browser.) 7. "more /etc/hosts" to see your local "internet name and address" file 8. "more /etc/protocols" to see what protocols can be carried in IP packets. 9. "more /etc/services" to see the ports are used by "well known" services. 10. "more /etc/resolv.conf" to see the nameservers your computer uses. 11. "ping www.temple.edu" - to see if computer www.temple.edu is alive and reachable. 12. "arp -a" to print Ethernet and IP address of other active computers on your LAN 13. "ifconfig to see your computer's Ethernet and IP addresses. 14. "netstat -nr" to print your computer's IP routing tables 15. "netstat -lut" (Listening Udp or Tcp sockets) to see the network services offered on Linux based systems. 16. "netstat -af inet | grep LISTEN" to see the network services on Sun or Dec Unix systems. 17. "netstat -i" to see statistics on packets sent and received. 18. "nslookup www.temple.edu" to find IP address of computer www.temple.edu 19. "nslookup", then "?" to do a lot more. 20. "traceroute www.bucks.edu" to determine the path to "www.bucks.edu" Results of executing Networking commands on the Linux system in my office. 1. linux:~ # ifconfig eth0 Link encap:Ethernet HWaddr 00:50:04:D3:C0:CA inet addr:192.168.1.102 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::250:4ff:fed3:c0ca/64 Scope:Link UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2517 errors:0 dropped:0 overruns:0 frame:0 TX packets:2057 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:1493378 (1.4 Mb) TX bytes:217474 (212.3 Kb) Interrupt:10 Base address:0x1000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:30 errors:0 dropped:0 overruns:0 frame:0 TX packets:30 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1956 (1.9 Kb) TX bytes:1956 (1.9 Kb) 2. linux:~ # netstat -lut Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address tcp 0 0 *:sunrpc tcp 0 0 *:x11 tcp 0 0 localhost:smtp tcp 0 0 *:ssh udp 0 0 *:bootpc udp 0 0 *:sunrpc 3. linux:~ # netstat -i Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR eth0 1500 0 2528 0 0 0 lo 16436 0 30 0 0 0 Foreign Address *:* *:* *:* *:* *:* *:* State LISTEN LISTEN LISTEN LISTEN TX-OK TX-ERR TX-DRP TX-OVR Flg 2062 0 0 0 BMNRU 30 0 0 0 LRU 4. linux:~ # /sbin/arp -a ? (192.168.1.147) at 00:06:5B:52:1D:70 [ether] on eth0 ? (192.168.1.1) at 00:04:5A:F3:D9:E1 [ether] on eth0 5. linux:~ # ping www.bucks.edu PING www.bucks.edu (192.231.233.6) 56(84) bytes of data. 64 bytes from www.bucks.edu (192.231.233.6): icmp_seq=1 ttl=47 64 bytes from www.bucks.edu (192.231.233.6): icmp_seq=2 ttl=47 64 bytes from www.bucks.edu (192.231.233.6): icmp_seq=3 ttl=47 64 bytes from www.bucks.edu (192.231.233.6): icmp_seq=4 ttl=47 --- www.bucks.edu ping statistics --4 packets transmitted, 4 received, 0% packet loss, time 3026ms rtt min/avg/max/mdev = 15.872/19.820/25.003/3.367 ms 6. linux:~ # traceroute -n www.bucks.edu traceroute to www.bucks.edu (192.231.233.6), 1 155.247.107.1 2.469 ms 2.336 ms 2 155.247.4.1 32.380 ms 31.799 ms 3 155.247.119.226 32.213 ms 32.263 ms 4 4.25.94.49 18.467 ms 18.293 ms 5 64.159.3.29 18.478 ms 12.350 ms ... 12 38.112.5.30 17.077 ms 17.709 ms 13 207.103.5.101 14.883 ms 17.671 ms 14 207.103.5.222 15.299 ms 15.814 ms 15 207.103.5.30 31.109 ms 76.618 ms 16 207.103.210.203 29.076 ms 38.247 ms 17 * * * 18 * * * time=18.1 time=20.2 time=15.8 time=25.0 ms ms ms ms 30 hops max, 40 byte packets 2.732 ms 31.181 ms 19.595 ms 18.317 ms 12.138 ms 13.827 16.511 19.462 67.554 59.058 ms ms ms ms ms 7. linux:/ # more /etc/services # See: http://www.iana.org/assignments/port-numbers echo 7/tcp Echo echo 7/udp Echo discard 9/tcp Discard sink null discard 9/udp Discard sink null daytime 13/tcp Daytime # Daytime (RFC 867) daytime 13/udp Daytime # Daytime (RFC 867) ftp-data 20/tcp # File Transfer [Default Data] ftp 21/tcp # File Transfer [Control] ssh 22/tcp # SSH Remote Login Protocol telnet 23/tcp # Telnet smtp 25/tcp mail # Simple Mail Transfer domain 53/tcp # Domain Name Server domain 53/udp # Domain Name Server http 80/tcp # World Wide Web HTTP epmap 135/tcp # DCE endpoint resolution netbios-ns 137/tcp # NETBIOS Name Service netbios-ssn 139/tcp # NETBIOS Session Service https 443/tcp # http protocol over TLS/SSL 8. linux:/etc # more /etc/protocols # See: http://www.iana.org/assignments/protocol-numbers # ip 0 IP # internet protocol v4 icmp 1 ICMP # internet control message protocol #ip 4 IP # internet protocol v4 tcp 6 TCP # transmission control protocol udp 17 UDP # user datagram protocol ipv6 41 IPv6 # IPv6