Using a Command Line Interface
A CoS126 Introduction
Long ago, before operating systems with graphical user interfaces (GUIs), everyone
used command line interfaces (CLIs). For example, instead of starting a program by
clicking the icon for your program in the Launchpad or whatever new‐fangled
mawhoozawhatzit, you instead typed the name of your program. And instead of
clicking on menus in your program to adjust settings, open files, etc, you could
specify these things as command line arguments.
In fact, expert computer users still use command prompts quite heavily. It’s an
incredibly useful abstraction that you’re now going to begin making use of.
A specific instance of the command line interface is called a “terminal window” by
Mac OS X (which utilizes a version of Unix under the hood), and the term “command
prompt” is used by Windows. The terms are virtually interchangeable. We will use
the term “command line interface” throughout this document.
Learning to fully utilize a command line interface is something that could (and does)
fill an entire book. In this tutorial, we’ll address the key ideas, give a few examples,
and leave you to learn the rest on your own as you choose.
The Basics – Opening the Command Line Interface
In Mac OS X, the terminal application can be found in Applications‐>Utilities‐
>Terminal.
In Windows, it can be found in Programs‐>Accessories‐>Command Prompt.
Note, there are many other ways of accessing the command line interfaces. All of
them are fine to use.
Prompt text
When you open your CLI, the first thing you’ll see is a prompt, i.e. a string of text that
lets you know the computer is waiting for you, the user, to take action.
In Windows, the default prompt is the entire path to your present working directory
(we’ll discuss what that means later) followed by a > sign. For example:
In Mac OS X, the default command prompt is your computer name, followed by the
name of your present working directory, followed by your user name, followed by a