Commands are verbs; they tell the computer to do something.
Once you have Terminal open, you should see a string of characters that ends with a dollar sign. This is called the command prompt. A prompt looks something like this.
walsh-9:~ bree$
Whenever you see a line in these slides prefixed with a $, that means that we’re typing something in at the prompt.
In terminal, type in the name of the command, and press <ENTER>. Let’s trying using ls, a command to list files and directories →
$ ls
Note that when you’re at the prompt, you’re always running commands in the context of some location on your computer.
Arguments are the thing or things that a command acts on; they’re like nouns (or more formally, direct objects).
Some commands can optionally have arguments:
Try this (list files in Desktop):
$ ls Desktop
Flags are like adverbs. They specify how a command is run.
(sometimes they’re also called options)
Commands can optionally have flags.
Try this (list all, including hidden, files in Desktop):→
$ ls -a Desktop
You can use the <TAB> key to complete commands or file names. Try typing the following:→
The argument, Desktop, is automatically completed for you! Go ahead and run the command by pressing <ENTER> →
What if there are multiple matches? Type the letter l and then <TAB>. What happens? →
Nothing. Now try hitting <TAB> one more time. What happens? →
All of the possible commands that start with the letter l are shown.
You can use the <UP> or <DOWN> keys to go through previous and next commands. Try pressing <UP> twice, and <DOWN> once. What command is shown?
$ ls Desktop
Type the letter l and press <ENTER>.
$ l
What happens? →
-bash: l: command not found
Type ls foo and press <ENTER>.
$ ls foo
What happens? →
ls: foo: No such file or directory
Entering commands flash cards x 5 (use set 1)
We’ll do this together, then try downloading it yourself:
…And… again!
Entering commands flash cards x 5 (use set 1)
We’ll do this together, then try downloading it yourself: