For many of you, this is the first time [or nearly so] that you are actually typing in real
commands to the computer. Usually, you boot your machine, wait for the windowing interface to appear,
then use the mouse [and some typed commands or keypresses] to accomplish your tasks in the windows
which get started by clicking on things. For this class, however, much of that familiarity will
RAPIDLY disappear.
Here's something to try: Go to your windowing interface and create six separate directories for your six favorite recording artists or movies or some other thing that you like, using your mouse and so on the way you normally do. How long did that take you? Now, open a terminal window and type the following command into it, then press 'enter':
mkdir 'Charli XCX' Halsey 'The Weeknd' Khalid 'Lady Gaga' Beyoncé
People that often use the command line are sometimes called power users. Why is the command line powerful?
context switchesto a mouse or trackpad [so it's often faster]
You can do almost anything from the command line! You don't need to launch many separate window-based applications. With the command line, you can:
To help you with navigating the command window [Windows] or terminal window [Mac/UNIX/Linux], here is
a handly table of some basic commands with explanations of what they mean and what they do. While it
is most definitely not exhaustive, and not even really comprehensive, it will at least provide you
with a reference of basic stuff
to get you going.
You start the Mac/Linux/UNIX command line from the finder, the launchpad, or the spotlight, or from the dock if you already have a shortcut there. It's also called "terminal" on the Mac.
From the Finder icon in the dock, click Applications
in the favorites list, then find the
Utilities
folder and click to open it; locate Terminal
and double-click the icon to open
the program.
From the Launchpad, click the Launchpad icon to open the screen of application programs; find
the Other
icon and click to open it. The Mac displays a set of utility programs. Locate the icon
for the Terminal program and click it. As an alternative, click the text area next to the magnifying
glass icon in Launchpad and type terminal
. Launchpad locates and displays the Terminal icon –
a handy time-saver if your MacBook has many programs. Click the icon to open the program.
From Spotlight, click the Spotlight
magnifying glass icon. In the text field that opens,
type terminal
. Spotlight displays a list of matches for the word terminal
including the
program. Click the entry for Terminal to open it.
Once the terminal window is open, you can use the commands from the following table. Remember that in
the following descriptions, the words directory
and folder
are treated as synonymous.
Item | Command | Meaning/Action Performed [possible "switches"] |
---|---|---|
1 | pwd | Output which directory is the current directory |
2 | cd <directory or path> | Change directory to that specified |
3 | ls | List the contents of the current directory |
3 | ls <directory or path> | List the contents of the named directory |
4 | mkdir <directory or path> | Make a new directory or subdirectory |
5 | rmdir <directory or path> | Remove a directory or subdirectory |
6 | rm <file or directory> | Delete a file |
8 | cp <source file> <target file> | Copy one file to another |
9 | more <file> | List out file contents, pause for each screen-full |
9 | cat <file> | List out file contents, but without pausing |
11 | man <shell> | List out the commands available for the shell |
12 | man <command> /? | Get the help page for <command> |
You start the windows command line by either finding it in the programs list by clicking through the
following process:
Start button -> All Programs -> Accessories -> Command Prompt
or by using the Run Box
by clicking through the following process:
Start button -> Search box -> type cmd
and press the ENTER key
You'll see the command window appear.
Once the command window is open, you can use the commands from the following table. Remember that in
the following descriptions, the words directory
and folder
are synonymous.
Item | Command | Meaning/Action Performed [possible "switches"] |
---|---|---|
1 | cd | Output which directory is the current directory |
2 | cd <directory or path> | Change directory to that specified |
3 | dir | List the contents of the current directory |
3 | dir <directory or path> | List the contents of the named directory |
4 | mkdir <directory or path> | Make a new directory or subdirectory |
5 | rmdir <directory or path> | Remove a directory or subdirectory |
6 | del <file or directory> | Delete a file |
7 | erase <file or directory> | Delete a file |
8 | copy <source file> <target file> | Copy one file to another |
9 | more <file> | List out file contents, pause for each screen-full |
9 | type <file> | List out file contents, but without pausing |
11 | help | List out the commands available |
12 | <command> /? | Get the help page for <command> |