Skip to content

Terminal Survival Guide

Time: ~7 minutes | Difficulty: Beginner

What You'll Learn

  • The 10 commands you'll use daily
  • Tab completion (your new superpower)
  • How commands differ between Mac/Linux and Windows

Windows Users

Use PowerShell (not Command Prompt) or Git Bash for the best experience. Git Bash gives you Unix-style commands on Windows.

The 10 Commands You Need

Mac/LinuxWindows (PowerShell)What It Does
pwdpwd or Get-LocationPrint working directory (where am I?)
lsls or dir or Get-ChildItemList files and folders
ls -lals -Force or dir /aList all files (including hidden)
cd foldercd folderChange directory
cd ..cd ..Go up one level
cd ~cd ~ or cd $HOMEGo to home folder

File Operations

Mac/LinuxWindows (PowerShell)What It Does
mkdir namemkdir name or New-Item -ItemType Directory nameCreate directory
touch fileNew-Item file or echo $null >> fileCreate empty file
rm filerm file or del fileRemove file
rm -rf folderrm -r -Force folder or rmdir /s folderRemove folder and contents
mv old newmv old new or Move-Item old newMove or rename
cp file copycp file copy or Copy-Item file copyCopy file

For This Bootcamp

Most commands work the same if you use Git Bash on Windows. We recommend Git Bash for consistency.

Be Careful

rm is permanent. There's no trash can. Deleted = gone.

Tab Completion — Your Superpower

Start typing, then press Tab:

bash
cd Desk<Tab>     # completes to: cd Desktop
cd Dow<Tab>      # completes to: cd Downloads

If multiple matches, press Tab twice to see options.

Paths Explained

SymbolMac/LinuxWindows
~Your home folder (/Users/yourname)Your home folder (C:\Users\yourname)
.Current folderCurrent folder
..Parent folder (one level up)Parent folder (one level up)
/Root of filesystemUse \ or / (both work in PowerShell)

Examples:

Mac/Linux:

  • Absolute: /Users/you/Desktop/project/file.txt
  • Relative: ./project/file.txt

Windows:

  • Absolute: C:\Users\you\Desktop\project\file.txt
  • Relative: .\project\file.txt or ./project/file.txt

Practice Session

bash
# Where are you?
pwd

# Go to Desktop
cd ~/Desktop

# Create a practice folder
mkdir terminal-practice
cd terminal-practice

# Create some files
touch file1.txt
touch file2.txt

# See your files
ls

# Rename a file
mv file1.txt important.txt
ls

# Go up and clean up
cd ..
rm -rf terminal-practice
powershell
# Where are you?
pwd

# Go to Desktop
cd ~\Desktop

# Create a practice folder
mkdir terminal-practice
cd terminal-practice

# Create some files
New-Item file1.txt
New-Item file2.txt

# See your files
ls

# Rename a file
mv file1.txt important.txt
ls

# Go up and clean up
cd ..
rm -r -Force terminal-practice

Keyboard Shortcuts

ShortcutAction
TabAutocomplete
↑ / ↓Previous/next command
Ctrl+CCancel current command
Ctrl+L or clearClear screen
Ctrl+AGo to line start
Ctrl+EGo to line end

Continue: Git in 10 Minutes →

Built for learning | Open source on GitHub