Learn Basic Command Line Usage

Learn Basic Command Line Usage

Course Module

Master essential terminal commands for navigating and managing files in both Windows and Mac/Linux environments.

← Back to All Modules

Recommended Prerequisites

🎉 You're good to go!

This module doesn't have any prerequisites. Jump right in and start learning!

Overview

The command line interface (CLI) provides powerful tools for navigating your file system and executing commands. Learning basic terminal usage is essential for software development, allowing you to perform tasks more efficiently than with graphical interfaces.

Installing Homebrew (Mac)

Homebrew is a package manager for macOS that simplifies software installation.

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew --version

Navigation Commands

These commands help you navigate through your file system:

  • pwd - Prints the current directory path (Mac/Linux only)
  • cd [folder] - Changes the directory to [folder]
  • cd .. - Moves up one directory level
  • cd / - Moves to the root directory
  • ls - Lists files in the current directory (Mac/Linux)
  • dir - Lists files in the current directory (Windows)
  • ls -l - Lists files in long format with details (Mac/Linux)

File Management

These commands allow you to create, delete, and manipulate files and directories:

  • mkdir [folder] - Creates a new folder
  • rmdir [folder] - Deletes an empty folder
  • rm -r [folder] - Deletes a folder and its contents (Mac/Linux)
  • del [file] - Deletes a file (Windows)
  • rm [file] - Deletes a file (Mac/Linux)
  • cp [source] [destination] - Copies a file or folder (Mac/Linux)
  • copy [source] [destination] - Copies a file (Windows)
  • mv [source] [destination] - Moves or renames a file or folder

Practice Exercises

Try these exercises to become comfortable with the command line:

  • Create a new directory and navigate into it
  • Create a few empty files in that directory
  • List the contents of the directory
  • Rename one of the files
  • Move a file to a different directory
  • Delete a file and then the directory

Additional Resources

  • Learn Enough Command Line to Be Dangerous by Michael Hartl
  • The Linux Command Line by William Shotts
  • Windows Command Line Tutorial by Microsoft
  • Mac Terminal Cheat Sheet by GitHub