Why programmers type instead of click — and the handful of commands that make you fluent.
pwd, cd, ls — and Tab> / >>GUI vs. CLI, and the tools we’ll use.
A command can be re-run tomorrow, exactly. A sequence of clicks can’t.
You say exactly which file and which option. No hunting through menus.
Save commands to a file → you’ve automated a task. That’s programming.
Paste a command into a chat or README. Try that with a screenshot tour.
Pipe the output of one tool into another to build something new.
Python, Git, uv, pandoc… every tool in this course has a CLI first.
Think of the CLI as the formula bar of your computer: the GUI shows results; the command shows what actually happened.
python, git, uv…Analogy: the terminal is a web browser; the shell is the website you’re visiting. One Windows Terminal window can host tabs of PowerShell, cmd, and even Linux (WSL).
Windows ships with the older Windows PowerShell 5.1. Install version 7 alongside it:
winget install --id Microsoft.PowerShell -e
Or from the Microsoft Store: search “PowerShell”. We’ll meet winget properly in Module 3.
Pin Windows Terminal to the taskbar. From now on, it’s your cockpit.
| Windows PowerShell 5.1 | PowerShell 7+ | |
|---|---|---|
| Program | powershell.exe | pwsh.exe |
| Comes with | Windows (frozen, maintenance only) | Separate install, actively developed |
| Runs on | Windows only | Windows, macOS, Linux |
| Default text encoding | Mixed (UTF-16 for > redirection!) | UTF-8 everywhere |
| Nice extras | — | cd -, && / ||, better errors, predictive IntelliSense |
Check which one you’re in:
PS C:\Users\Jane> $PSVersionTable.PSVersion
Major Minor Patch
----- ----- -----
7 4 6
PS C:\Users\Jane> _
PSC:\Users\Jane>On slides and in docs, the prompt is shown for context — don’t type it. Only type what comes after >.
Where am I? What’s here? How do I go there?
pwd, ls, cd| Question | Command |
|---|---|
| Where am I? | pwd |
| What’s here? | ls or dir |
| Go there | cd <path> |
PS C:\Users\Jane> pwd
Path
----
C:\Users\Jane
PS C:\Users\Jane> cd C:\actuarial_work\sandbox
PS C:\actuarial_work\sandbox> ls
Directory: C:\actuarial_work\sandbox
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 09/29/2026 10:14 AM data
d---- 09/29/2026 10:14 AM notebooks
-a--- 09/29/2026 10:20 AM 16 model.py
cd patterns you’ll use every day| Command | Goes to |
|---|---|
cd data | The data folder inside the current one (relative) |
cd .. | Up one level (parent) |
cd ..\.. | Up two levels |
cd ~ | Your home folder, C:\Users\Jane |
cd \ | The root of the current drive, C:\ |
cd C:\actuarial_work | An absolute path — works from anywhere |
cd - | Back to where you just were (PowerShell 7) |
D: | Switch to drive D: |
Forward slashes work too: cd C:/actuarial_work/sandbox.
PowerShell’s real commands (cmdlets) are named Verb-Noun. The short, familiar names are aliases, so both Windows and UNIX habits work.
PS> Get-Alias ls
CommandType Name
----------- ----
Alias ls -> Get-ChildItem
| Alias | Cmdlet | Does |
|---|---|---|
pwd | Get-Location | Show current folder |
cd | Set-Location | Change folder |
ls, dir | Get-ChildItem | List contents |
cp, copy | Copy-Item | Copy |
mv, move | Move-Item | Move / rename |
rm, del | Remove-Item | Delete |
cat, type | Get-Content | Show a file |
cls, clear | Clear-Host | Clear screen |
Never type a full path. Type a few letters, then press Tab.
PS C:\> cd act⇥ → cd .\actuarial_work\
PS C:\> cd .\actuarial_work\sa⇥ → cd .\actuarial_work\sandbox\
Tab-completion is faster and it’s a spell-checker: if Tab doesn’t complete, the thing you’re typing doesn’t exist. It also adds quotes around paths with spaces for you.
Create, copy, move, delete — and read the syntax of any command.
mkdir pricing # new folder
mkdir pricing\data\raw # creates nested folders in one go
New-Item -ItemType File pricing\README.md # new empty file (short form: ni)
cp C:\Users\Jane\Downloads\claims.csv pricing\data\raw\ # copy a file in
cp pricing\data -Destination backup_data -Recurse # copy a whole folder
mv pricing\data\raw\claims.csv pricing\data\claims_2025.csv # move AND rename
mv notes.txt old_notes.txt # rename in place
rm old_notes.txt # delete a file
rm backup_data -Recurse # delete a folder and everything inside
rm does not use the Recycle Bin. Deleted means gone. Add -WhatIf to preview what would be deleted: rm *.tmp -WhatIf
Get-ChildItem C:\actuarial_work -Filter *.csv -Recurse
-. Some take a value (-Filter *.csv); some are on/off switches (-Recurse, -Force).Get-Help Copy-Item -Examples
Get-Command *item* # find commands by name
python --help # most other tools
You can shorten parameter names while they stay unambiguous: -Recurse → -r, -Force → -fo. Tab-complete works on parameters too: type - then Tab.
Spaces separate arguments. So this is three arguments, not one path:
PS> cd C:\Users\Jane\OneDrive - Contoso\Documents
Set-Location: A positional parameter cannot be found
that accepts argument '-'.
Fix it with quotes:
cd "C:\Users\Jane\OneDrive - Contoso\Documents"
cd 'C:\Program Files'
| Quotes | Behavior |
|---|---|
'single' | Literal — exactly what you typed |
"double" | Expands variables: "$HOME\data" → C:\Users\Jane\data |
To run a program whose path is quoted, prefix it with & (the call operator):
& "C:\Program Files\Git\bin\git.exe" --version
This is why we named it actuarial_work, not Actuarial Work.
Look inside files, connect commands together, and save the results.
cat data\claims.csv # whole file (Get-Content)
cat data\claims.csv -Head 5 # first 5 lines — perfect for peeking at big CSVs
cat logs\run.log -Tail 20 # last 20 lines
cat data\claims.csv | more # one screen at a time (Space = next, q = quit)
Select-String "LAPSE" data\*.csv # search inside files (like Ctrl+F across many files)
Select-String "error" logs\*.log -CaseSensitive
A 2 GB extract will crash Excel. cat big.csv -Head 5 shows you the header row instantly.
|: output of one → input of the nextGet-ChildItem C:\actuarial_work -Recurse -File |
Where-Object Length -gt 1MB |
Sort-Object Length -Descending |
Select-Object -First 5 Name, Length
cat data\claims.csv | Select-String "MOTOR" | Measure-Object # how many motor claims?
PowerShell pipes objects (with properties like Name, Length), not just text. That’s why Sort-Object Length just works.
> and >>ls data > inventory.txt # create / OVERWRITE
Get-Date >> run_log.txt # APPEND a line
python model.py 2> errors.txt # save only error output
Select-String "LAPSE" data\*.csv > lapses.txt
> | Write to file, replacing it |
>> | Append to end of file |
2> | Redirect errors only |
> overwrites without asking. ls > model.py just destroyed your model.
In old Windows PowerShell 5.1, > writes UTF-16 text that Python and Git find odd. PowerShell 7 writes UTF-8 — one more reason to upgrade.
| Keys | Action |
|---|---|
| Ctrl+C | Interrupt the running program |
| ↑ / ↓ | Previous / next command in history |
| Ctrl+R | Search history as you type |
Ctrl+L / cls | Clear the screen |
| Esc | Erase the current line |
| Home / End | Jump to start / end of line |
| Ctrl+← / → | Jump a word at a time |
| Ctrl+Shift+T | New tab |
| Alt+Shift+D | Split pane |
| Ctrl+V / right-click | Paste |
| Select text + Ctrl+C | Copy (only when text is selected) |
Ctrl+C means copy only if text is highlighted; otherwise it means stop.
Some programs run until you stop them — servers, infinite loops, a Monte-Carlo run with a typo in the iteration count.
Try it now:
PS> ping -t localhost
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
... ← press Ctrl+C
Control-C
PS> _
If the terminal seems “frozen” and the prompt hasn’t come back, a program is still running. Ctrl+C first; closing the window is the last resort.
Later, uv run jupyter lab will keep running on purpose — Ctrl+C is how you shut it down cleanly.
Rules: mouse off the desk. Explorer closed. Everything happens in Windows Terminal.
C:\actuarial_work\huntUse Tab for every path. Count how often you need it — the answer should be “constantly”.
$root = "C:\actuarial_work\hunt"
$deep = "$root\region_north\2025\q3\claims\archive"
New-Item -ItemType Directory -Force -Path $deep, "$root\region_south\2025\q1" | Out-Null
Set-Content "$root\START_HERE.txt" "Clue 1: Go deep under region_north. The next clue is HIDDEN (try ls -Force)."
Set-Content "$deep\clue2.txt" "Clue 2: Count every LAPSE in every .csv under hunt. Then find FINAL_CLUE.txt."
attrib +h "$deep\clue2.txt" # mark the file as Hidden
Set-Content "$root\region_north\2025\q3\policies.csv" "policy_id,status`nP001,IN_FORCE`nP002,LAPSE`nP003,IN_FORCE"
Set-Content "$root\region_south\2025\q1\policies.csv" "policy_id,status`nP101,LAPSE`nP102,LAPSE`nP103,IN_FORCE"
Set-Content "$root\region_south\FINAL_CLUE.txt" "Final: Put the lapse count in hunt\answer.txt using >"
The backtick-n (`n) inside double quotes is PowerShell’s newline — like \n in Python.
cd into hunt and read START_HERE.txtls -Force)ls -Recurse -Filter *.csv | Select-String LAPSE, then pipe to Measure-Object)answer.txt with >; check with catC:\actuarial_work\lapse_study\data\raw in one commandpolicies.csv files into raw, renaming them north_q3.csv and south_q1.csvcat -Headlapse_study (ls -Recurse) to inventory.txthunt folder — safely, with -WhatIf firstpwd · ls · ls -Forcecd path · cd .. · cd ~ · cd -
mkdir · ni filecp a b · mv a brm x · rm dir -Recurse
cat f · cat f -Head 5Select-String pat files… | more
a | b pipe> overwrite · >> append
Tab · ↑ · Ctrl+C
Ctrl+R · Ctrl+L
Get-Help cmd -ExamplesGet-Command *word*tool --help
cd, ls, pwd — using Tabrm)| and redirect with > / >>PATH & Software InstallationWhen you type python, how does Windows know which program you mean? And how do you install new ones?