Command Line
caution
Proceed with caution: This page is still under construction!
#
What is the command line?The command line is an interface that allows you to provide text-based commands for computers to execute.
#
Does my computer have a command line?Every computer comes equipped with a system-wide command line interface (CLI) called a shell. Depending on the operating system of your computer, the default shell is:
- Z shell or Bash on macOS and Linux
- PowerShell on Windows
These shells run programs within a terminal application, such as Terminal on macOS. While shells all serve a similar purpose, they are each different in various ways, including their command prompts. The prompts are
%
for Z shell$
for Bash>
for PowerShell
#
What makes something a command?A command is made up of a sequence of arguments. In most cases, the first argument of a command is the command name, so we will consider a command the combination of two conceptual parts:
- The command name to express the program you wish to use, and
- The arguments the program should consider (oftentimes split into options).
#
Example commands in BashLet's consider a few example commands using Bash, meaning all commands will begin after the $
prompt in a terminal. For this set of examples, suppose we start inside a folder called parent
that has a child folder, child
. Then, the child folder has two .txt
files inside of it. This tree diagram may help visualize the nested file structure we've described:
To navigate from inside the parent
folder to the child
folder, run
which calls cd
with an argument to go into the directory child
. Then, if you'd like to see the contents of child
, run
which calls ls
without arguments to list of the two files file-1.txt
and file-2.txt
inside of child
. When it's time to navigate back to parent
, run
which calls cd
with an argument to go up one directory (the ..
) in the tree and into the parent
directory (the /parent
).
#
For Experienced UsersOnce you feel more comfortable with the concept of command line tools, and have had some real experience using one for a project, it's time to step up your game. While many avenues are available, these referenced links include useful collections of materials to make your command line experience even better: