Introduction
Opening the command line
Mac users, find Terminal using the search icon on the upper right corner of your Desktop (or in your Applications folder).
PC users, you can find Command Prompt from the Start Menu.
Where am I?
When you first open your shell, you’ll automatically be in your home directory. Your home directory is something like /Users/yourusername
- it’s the folder that Desktop, Documents, etc all sit inside. Use the ls
command to list what else is in your home directory. If you get lost, you can also use pwd
to print the working directory, a.k.a. the folder you’re current inside of.
Windows: Use
dir
instead ofls
, andchdir
instead ofpwd
Whenever you’re working on python scripts (or other projects), make sure you’re in the correct directory!
Definitions
- A directory is a folder.
- A path is a series of folders that lead to something. For example, if you have a file called
cats.jpg
inside of a folder calledcat pictures
on your desktop, its full path is/Users/username/Desktop/cat pictures/cats.jpg
. If you’re already in the desktop, its path is justDesktop/cat pcitures/cats.jpg
- A command is something you type on the command line (duh). In
ls -lah
, thels
part is a command. - An argument is something typed after the command. In
cat description.txt
,description.txt
is an argument. - A flag is typed after the command, and has a
-
in front of it. Inls -lah
, the-lah
part is a flag. Why is a flag different than an argument? No good reason.