Wednesday, February 28, 2007

Linux Commands

Dell is promising to start selling low end computers with linux pre-installed , which means my company , which has adamently said "we don't support linux and NEVER !!! will ! " will probably receive rather different marching orders from our biggest client in the near future.

Gonna jot down a few useful linux commands here , just to get things rolling.

Most version's of linux will have a "desktop" running. That is to say menus and buttons and pretty little icons you just click on , just like windows. You need to get to the terminal application , which is the equiviliant of a dos prompt in windows.

On Gnome it's Applications > Accessories, Terminal

In the Terminal , these are some useful commands. I ran them on my Ubuntu 6.1 linux box.

Dos : IPCONFIG
Linux : ifconfig
eth0      Link encap:Ethernet  HWaddr 00:11:5B:1F:83:A6
inet addr:192.168.2.3 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::211:5bff:fe1f:83a6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1492 Metric:1
RX packets:110531 errors:0 dropped:0 overruns:0 frame:0
TX packets:88421 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:102228257 (97.4 MiB) TX bytes:12372057 (11.7 MiB)
Interrupt:185 Base address:0xc400

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:583 errors:0 dropped:0 overruns:0 frame:0
TX packets:583 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:58547 (57.1 KiB) TX bytes:58547 (57.1 KiB)

Second line down gives the ip address.
inet addr:192.168.2.3

dos : PING
Linux: ping

PING www.yahoo.com (69.147.114.210) 56(84) bytes of data.
64 bytes from f1.www.vip.re3.yahoo.com (69.147.114.210): icmp_seq=1 ttl=55 time=39.4 ms
64 bytes from f1.www.vip.re3.yahoo.com (69.147.114.210): icmp_seq=2 ttl=55 time=36.2 ms
64 bytes from f1.www.vip.re3.yahoo.com (69.147.114.210): icmp_seq=3 ttl=55 time=85.9 ms
64 bytes from f1.www.vip.re3.yahoo.com (69.147.114.210): icmp_seq=4 ttl=55 time=34.5 ms

--- www.yahoo.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 15263ms

rtt min/avg/max/mdev = 34.554/49.064/85.919/21.352 ms

Unlike the dos ping , it doesn't stop after 4 pings, you must control-c it to halt it. 

dos : TRACERT
linux : tracepath

Again. Control-C to halt it.

1:  192.168.2.3 (192.168.2.3)                              0.234ms pmtu 1492
1: 192.168.2.1 (192.168.2.1) asymm 2 8.205ms
2: gw03.slnt.phub.net.cable.rogers.com (66.185.90.145) 9.943ms
3: gw01.slnt.phub.net.cable.rogers.com (66.185.93.193) 8.937ms
4: gw03.etob.phub.net.cable.rogers.com (66.185.83.198) asymm 5 12.846ms
5: gw02.mtnk.phub.net.cable.rogers.com (66.185.80.185) 14.413ms
6: igw01.ny8th.phub.net.cable.rogers.com (66.185.81.13) 32.634ms
7: no reply
8: ge-0-0-9.p815.pat2.dce.yahoo.com (216.115.98.109) 36.734ms

Oddly enough there are two line 1's, the first one is the local computer, the second is my router.

DOS : arp /a
linux : arp

Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.2.1 ether 00:17:3F:67:96:02 C eth0


Yup, thats the mac id on the back of my router, and thats the routers ip address. Good for those customers who say "Oh I don't have a router" but yes they do . "I you mean this linksys thing ? I forgot about that ... "

Yes m'am.

Dos : telnet
linux: telnet

telnet www.yahoo.com 80
Trying 69.147.114.210...
Connected to www.yahoo.com.
Escape character is '^]'.

telnet> Connection closed.

Telneting to yahoo on port 80, in effect using the telnet command to imitate a browser. If it works ("connected to www.yahoo.com") then you know there's no fire wall sitting on port 80, their browser is messed up. If it doesn't ... hopefully the firewall throws a pop up that you can read identifying it. If it rolls over and dies with unknown error, tcp/ip is shot. Control - close square bracket to end, as it says above ("Escape Charactar is ...")


Those are all the dos commands I've ever used at work in 5 years of trouble shooting , so that will probable do us fine.

(edit)
Yeah I forgot netstat. But when i tried it on linux the read out was ten pages long. Forget it ! Not worth the hassel of a customer wading through that !

No comments: