Just thought I'd whip up a few of the windows command line based utilities you can use for networking functions. All these commands are typed at the command prompt in windows. Older versions may not have all of them, but winxp and win2k have them all.
ping - We all know this one, sends an ICMP echo request packet to the target and tells you by the response whether its up or not. Some options you may not know are
-t you can continuous ping,
-r you can record the route it takes
-l set the size of the ping packet
-f set the dont fragment bit (use this with -l to see the max unfragmented packet size MTU a system can handle)
tracert - another staple utility, it traces the hosts that a packet from your machine will go through to reach a destination.. will show you all the routers and firewalls along the way. It works by starting with an initial TTL of 1 and increasing it for each 'hop', whenever the TTL expires, the system it expires on sends an ICMP message back and we can record the route.
option : -d makes it work faster by not resolving names
netstat - shows you the list of connections to and from your machine, including what ports are listening for connections. options
-a shows listening ports
-n doesnt resolve names (faster)
btw I recommend TCPView instead of this, see my review of it in the Cool Software forum
arp - shows you your machines arp cache. Try pinging a broadcast address and then do arp -a to see all the hosts that responded (For a discussion on why some hosts didn't respond, tfs has a post in this forum somewhere)
route - shows you your machines routing table and lets you add / delete entries.. type route print
nbtstat - shows you the target windows machine's remote name table : options -a takes a hostname, -A takes an ip address.
Tip: any system that has a <20> in the list it returns is offering file sharing services. A <03> listing which is not the same as the computers name is the username of the currently logged on user.
example : SAHIRH <03> UNIQUE Registered[/b]
net - This is a workhorse command, it lets you connect to other windows machines, add and delete users, see the list of windows shares etc etc. Too much to cover, type net help to see a list of commands and then net <command> help for detailed help on a command.
ipconfig - You should all know this one, shows you your current IP address and subnet mask, if you use DHCP it lets you release and renew the IP. I use this to make a quick batch file script to find out my ip.
make a batch file with the following lines and put it in a directory in your path (eg c:\windows):
ipconfig | find "IP address" /I
Phew that was a long post ! I know some of you probably know about all these but may not know about some of the more esoteric options. Plus for newbies, learning to use these tools early is a must.
I'm always amazed how Sahir has the talent of starting off really good posts. I agree - the command line is the way to go. Remember the days that your OS would run in 640k of RAM? (Ok, Ok, so I'm old. Enough already!) Well, it did so because the user interface was simple and efficient - the command line. Now it takes about a hundred meg and four minutes to provide you with all sorts of embellishments and little animated sheafs of flying paper when all you want is to delete the !! file.
Seriously though, if there are command line alternatives to WIndows tasks they are well worth learning. Case in point - Microsoft Cluster Services under NT. This uses a clunky and slow GUI to show you where the resources are. But you can do it all from command line also, and it goes like a rocket in comparison.
Re: The Power Of Command Line Tools
14 years 4 months ago #3765
I couldn't agree more with you Bishop on both paragraphs!
Have you ever tried deleting a directory (and empty the recycle bin) with over 6000 files under windows 95/98 ? You'll be able to have a quick shower, grab something to eat while you watch your favourite series and even by that time, it might still not be complete!
Until the "deltree" command was removed from the Dos shell, I would open a dos shell and use that awesome command which took a few seconds only, and not hours !
Yeah. I remember the first time I saw a Windows NT server (3.51). I remember disparaging it on the basis that why anyone would want to put a high-resolution graphical front-end onto a SERVER box was beyond me, and wondering how badly the server part (you know, the part you actually want when you implement a server) would run as a result of having to support all that overhead. Well, now we know!
Re: The Power Of Command Line Tools
14 years 4 months ago #3771
This may sound silly to some, but there is a certain purity from working at the command line. It makes you think through things logically rather than mindlessly pointing and clicking. There is nothing nicer than seeing someone crafting a really well thought out CLI command to accomplish a task that would take you minutes to execute with a GUI.
A lot of programmers see this when they understand a particularly well written piece of code.. you look at it and you say 'wow, that is pure genius...' its the same thing in bite sized chunks..