Learn the ins and outs of CLI
The command line is a text interface for the computer's operating system. To access the command line, we use the terminal.
A filesystem organizes a computer's files and directories into a tree structure. It starts with the root directory. Each parent directory can contain more child directories and files.
- Galvanize - How to Use Terminal
- codecademy: Learn the Command Line
- The Command Line Crash Course
- Meet the Command Line
- Learn Enough Command Line to Be Dangerous
- Open Spotlight
COMMAND + SPACE
- Type: terminal
- Click on the Terminal application (black box icon)
- Feel free to add to your dock
First, I'd recommend referencing the cheat sheet and making flash cards for the commands to go accompany you.
Let's begin! Where are we? Seriously, where are we!?!?
A very helpful command that I use often is pwd
present working directory. Which shows your where you currently are.
You're most like sitting in the user file that you logged into:
/Users/whateveryounamedyourmac
Now that we have a sense of where we're at, let's look around!
We can use ls
to list all of the directories available within this path
find a directory in which you'd like to explore and we'll move on,
Great, now that we know where we are, let's do some exploring! ...baby steps though!
We can jump between Directories or 'Folders' with the command cd
for change directory
Let's try it out, let's explore that directory!
cd directory
if your directory is not a single word, you'll need quotation marks, i.e. `cd "Let's Explore"
Don't worry about getting trapped in a directory, you can easily navigate back with cd ..
To navigate back multiple directories in a single line, use cd ../../../..
for however far you wish to go.
Wasn't that great!? but we can't settle on just exploring these directories, let's create our own adventure!
Let's dive right in and create a new directory
type mkdir name
and do a quick pwd
to make sure your new directory has been created
Nice Work!