The command line is a magic place where you hold court with the intimate secrets of your computer. It’s where the inspiration comes from for Matrix screensavers or hacking montages. It’s the best! You’ll be spending a ridiculous amount of time on the command line.

It’s also called the terimnal or the shell or any number of other names.

The Concept

When you have the terminal open, you’re somewhere inside of your computer, in a directory (a.k.a. folder). Most of your time will be spent moving from one directory to another in order to get to files you’ve downloaded, scraped or generated.

Opening the command line

OS X

Go to the upper right-hand corner of your screen, click the magnifying glass, and search for Terminal. Click it, and there you go!

Windows 10

Google “bash shell Windows 10” and read the first result. I don’t have internet right now so I can’t do it for you.

Windows also comes with two other shells - the command prompt and PowerShell. PowerShell is supposedly pretty awesome, but the bash shell is more like what you’ll experience on a server, so it’s best to stick with that.

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.

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 called cat 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 just Desktop/cat pcitures/cats.jpg
  • A command is something you type on the command line (duh). In ls -lah, the ls 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. In ls -lah, the -lah part is a flag. Why is a flag different than an argument? No good reason.