Command line concepts: What is C:\> anyway?
January 24th, 2006 by Chuck Sharp
“In the beginning was the command line” is a common quote you’ll hear from geeky geeks. The command line was the first really usable user interface for computer systems, and I believe it’s still a valuable and really efficient tool for some tasks. If you learn to use the command line effectively, you’ll have access to parts of your PC that you’d never have otherwise.
1. Concepts
In order to understand the command line, you need to understand it’s 3 major concepts: the presentation, the environment, and the command.
The presentation
A command line is a text-only interface where you direct the computer with text-based commands and it presents you with text output of its results.
There is always an input command prompt. In the DOS and Windows command line, the prompt ends with the “>” character and has a blinking text cursor that shows you where your text will appear when you type. That says to the user: “I’m awaiting orders!”
The command line is line-oriented. That is, everything is separated by distinct lines of text. You send a command to the command line processor by typing a line and then pressing enter. It sends back one or more lines of text back, and then, on a new line, gives you the next command prompt. If you want to see what the last command was, you look at the lines previous to the current prompt. That is, everything is separated by lines of text, and new lines always go underneath the older ones. Once all the space on the screen has been filled up with lines, every new line pushes the rest of the lines higher on the screen. The oldest lines (those at the top of the screen) disappear of the top.
If you look back over a session at a command line, it often looks like a screenplay-like dialogue between the computer and the user. In fact, using the command line is very similiar to having a dialogue with a computer, even if it is a pretty dry one.
The environment
Whenever you type a command at a prompt, the command line processor makes several assumptions. These assumptions together are called the command line environment.
The biggest assumption is what folder/directory a command should be run in relation to. This directory is called the working or current directory, and it’s a really important term to know. If I type the command ‘del file1.txt’, I’m telling the computer to delete the file called file1.txt. The question is, where is that file? What folder is it in? In the Windows command prompt, it shows a directory name right before the ‘>’ sign, for example, ‘C:\WINDOWS’. That directory is the current directory. Whenever any command refers to file name with referring to the file’s directory, the command line processor assumes that the user means that file within the current working directory.
When you type a command, the computer assumes certain things. These assumptions make up what’s known as the command line environment. Probably the biggest assumption is what location on the computer’s hard drive and folders you are referring to when you mention a file name in a command. Often times, a command is used to delete a file. For example, the command ‘del testfile.txt’ says to delete the testfile.txt file. The question is, where is this file? Every command prompt assumes a certain directory is the current, or working directory. It’s easy to change the current working directory, but it must be explicitly done.
The command
Inputting a command is done by typing a line and pressing enter. The line is separated into two parts, the command and its arguments. The command and the arguments are all separated by spaces, just like words in a sentence are.
For example, if I wanted to list the files within the current directory, I’d use the command ‘dir’. Now, let’s say that there are so many that I can’t see the entire listing at once. Then I’d use the command ‘dir /p’. That option, ‘/p’, is used to tell the directory listing that you want it to stop after each screenfull (page) of file listings so you can look at the entire listing.
The point is, commands become really versatile and powerful when you can give them arguments.
Many, if not most commands have a ‘/?’ option that gives you a little help on the options available. For example, I can use the command ‘dir /?’ to get a list of all the ‘dir’ options available, and the correct command syntax (syntax is the correct arrangement of arguments and options).
2. A Real Example
If you have Windows 2000 or Windows XP, you can get a quick look at your network settings using the command line. This is useful if you ever have to call your Internet provider. Here are the steps:
- Click on the Start Menu, and choose Run.
- Type in ‘cmd’ without the quote marks, and press enter. This will bring up a command line window. You will see a command prompt that ends with ‘>’ and a blinking text cursor.
- Type ‘ipconfig’ without the quotes and press enter. The ipconfig program displays network settings, like your PC’s current IP address. It will then display the next command prompt.
- If you press the up arrow on your keyboard, it will display the last command you entered. Do that, and then press a space and type ‘/all’. THis will run the same command but with the ‘/all’ option, which displays more detailed info. It will return again to the command prompt.
- To see what other option this command has, press the up arrow again to recall the last command, backspace over ‘/all’, type ‘/?’, and press enter.
- To close the command line, you either type the ‘exit’ command and press enter or just click on the ‘X’ on the upper right corner of the window.
3. More resources
Technorati Tags: command line, computer, command prompt
Entry Filed under: PC Basics









Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed