By the end of this chapter, you should be able to:
Terminal is an application that gives us a command line interface (or CLI) to interact with the computer. Everything you can do in Finder you can do in Terminal. Developers use Terminal because, more often than not, it is much faster to use Terminal than a graphical user interface (GUI) such as Finder. Although the Terminal interface can seem daunting at first, with a bit of practice, you'll be up to speed in no time!
You will also hear the term "shell" when learning about Terminal so it is important to distinguish between these terms. From Stack Overflow:
The shell is the program which actually processes commands and returns output. Most shells also manage foreground and background processes, command history and command line editing. These features (and many more) are standard in bash, the most common shell in modern linux systems. (We are using
A terminal refers to a wrapper program which runs a shell. Decades ago, this was a physical device consisting of little more than a monitor and keyboard. As unix/linux systems added better multiprocessing and windowing systems, this terminal concept was abstracted into software.
In Terminal, all files and folders begin at the root directory. The root directory is noted by a
/. Inside the root directory are essential files/folders that your machine needs, but we do not modify the files and folders in the root directory often. Inside of the root directory, we have a folder called
Users which contains all of the user accounts on your computer. If you move into the directory for your user account, you will be in the
home directory, which is denoted by
~. For example, if your user name on the computer is
eschoppik, then your home directory would be
/Users/eschoppik. A synonym for the
/Users/eschoppik path is
~ when you are logged in as
The first thing you want to start to understand when using Terminal is how to navigate from folder to folder. One of the most common commands you will be using in Terminal is
cd which is short for "change directory." In order to change a directory, type
cd followed by the directory or a path to the directory. If we want to move up a directory we use
cd .. and if we want to move into a directory we specify the name of the directory we are moving into. For example, if you are in your home directory and type
cd Desktop, you should move into your Desktop directory.
We just mentioned that you can type
cd followed by a directory or path. But what is a path? Let's learn some more vocabulary:
A path is simply the way to reach a file or folder; it's like an address for the file or folder you're trying to reach. When we specify a path starting from the root directory
/, we call that an absolute path. For example, if I am currently in the
~ home directory and I would like to change directories into my Desktop folder, I can do that in two of the following ways:
cd Desktop- relative to where I am currently
cd /Users/eschoppik/Desktop- absolute, starting from the root (first
~? What do we call each of these directories?
When you're ready, move on to Working with Files and Folders