Help      |      Chebucto Home      |      News      |      Contact Us     

126. The Power of the Command Line

By Andrew D. Wright

Blank, mysterious, powerful, it's the common link between all major operating systems. The command line makes most people nervous.

People are more familiar with point and click programs for most of their computing needs. However, buried at the heart of Windows, of Macintosh OS X, of Linux and Unix is the command line, holdover from the olden days of computing.

In Windows, go to the Start menu then Run then type in: cmd and hit OK to open a command line window.

To use the command line you type in a command and hit enter. The computer will then look for a program with the name you typed and run the program. The folders where the computer will look for the program are called the path. The path is an environmental variable, which means it can be altered or added to by the user.

You can set the path by clicking Start then right clicking on My Computer and selecting Properties. Click on the Advanced tab and the Environmental Variables button. Under System variables will be the path. Double click on it to edit it. Folders are separated by semi-colons.

I usually create a folder called Batch on my C: drive and make a path to it. Any new command line programs I get I put in this folder so I can run them from any command prompt in any folder.

You can run a program from the command line if you are looking at the folder the program is in, or if the folder is listed in the path. Most programs that can be run from the command line have switches that will make the program do different things. One of the most common switches is for help with a program, usually a listing of the available switches and what they do.

To use the help switch, type in a command, put in a space then type /? and hit enter.

A common command line use is to diagnose an internet connection problem. A good way to do this is to ping a server, which means sending it a data packet and getting it back. I like to use the Chebucto Community Net server for this, since it is a long-standing machine name on the internet and it has a catchy easy to remember IP address.

The first thing to try is to ping the server. To do this type:

ping chebucto.ca

The response should look like this:

Pinging chebucto.ca [192.75.95.75] with 32 bytes of data:

Reply from 192.75.95.75: bytes=32 time=18ms TTL=250

Which tells us the computer can successfully look up the domain and communicate with it. If this doesn't work, then maybe the IP address could be pinged: ping 192.75.95.75

If this gets a reply where the domain name didn't, then it means the computer cannot reach a DNS domain name lookup server, usually due to over-zealous firewall settings.

Another handy networking command is ipconfig, which will show you information on your network adapters. Use the /all switch for detailed information, use the /renew switch to reset network connections and of course, the /? switch for more options and help.

Commands can be put together so that one program can run after another, or based on what the first program did, a different program might be run instead. These combinations of commands are called batch files. They are really just text files made executable with the .BAT file name extension. Batch files can be used to automate a sequence of frequently run programs among other things.

Long-time Chebucto Community Net contributor and Userhelp volunteer Richard Bonner has put together a popular and heavily visited guide to the command line online.

 

http://www.chebucto.ns.ca/~ak621/DOS/

 

The Mousepad runs every two weeks. It's a service of Chebucto Community Net, a community-owned Internet provider. If you have a question about computing, email mousepad@chebucto.ns.ca or click here. If we use your question in a column, we'll send you a free mousepad.

 

The Mousepad Index

 

Originally published 22 February 2008


 


Our community is online here!

 


This column is provided as a community service by