1 Setting up Computing Environment
Learning goals 1) Recognize how files, folders, and paths work across macOS, Windows, and Linux.
2) Use a terminal to navigate and run simple commands.
3) Install R, RStudio, and Quarto; verify your setup.
1.1 Operating Systems
Most students are familiar with Windows, but data science workflows often run on macOS or Linux. To keep everyone on the same page for command-line work, we will treat macOS and Linux as a single “Unix-like” family and help Windows users bridge to the same environment via WSL (Windows Subsystem for Linux).
What is an Operating System?
An operating system (OS) manages your computer’s resources (CPU, memory, storage, files, and processes) and provides interfaces (GUI and terminal) for people and programs to interact with hardware.
1.1.1 The big three
- Windows — Ubiquitous on personal laptops; historically less aligned with Unix tooling, but excellent with WSL.
- macOS — Unix-based; ships with a terminal and many developer tools out of the box.
- Linux — Open-source family used on servers, clusters, and cloud VMs; many distributions (Ubuntu, Fedora, Debian) share common command-line tools.
Why this matters in data science
Reproducibility and collaboration require knowing your OS, versions, and paths. Most research servers and HPC clusters run Linux. Learning a command-line interface (CLI) gives you a common language across systems.
1.1.2 Quick checks: what am I running?
Open a terminal and run one of the following:
# macOS / Linux / WSL
uname -a
# Windows (PowerShell)
ver
If you see Linux details on a Windows laptop, you are inside WSL.
1.1.3 File systems and paths
- Unix-like path style:
/home/alex/project/data.csv
- Windows path style:
C:\\Users\\Alex\\project\\data.csv
On macOS/Linux, your home is typically /Users/<name>
(macOS) or /home/<name>
(Linux). On Windows, it is usually C:\\Users\\<name>
.
Naming habits that save you pain
Avoid spaces in file and folder names. Prefer kebab-case
or snake-case
. Keep a project’s scripts, data, and reports together.
1.1.4 Windows Subsystem for Linux (WSL)
WSL lets you run a real Linux environment (e.g., Ubuntu) inside Windows, so your terminal commands match those of macOS/Linux users. This is the recommended setup for Windows in this course.
1.1.4.1 Install WSL (Windows 11 or Windows 10 ≥ 2004)
- Open PowerShell as Administrator.
- Run:
--install wsl
- When prompted, choose Ubuntu and set a Linux username and password.
- (Optional) Ensure WSL2 is the default:
--set-default-version 2 wsl
- Verify:
--status
wsl -l -v wsl
You should see Ubuntu
listed and version 2
.
1.1.4.2 Start using WSL
- Launch the Ubuntu app (or run
wsl
in PowerShell).
- You are now at a Linux shell (bash). Try:
pwd # current directory in the Linux filesystem
ls # list files
whoami # your Linux username
1.1.4.4 Line endings and Git on Windows/WSL
Configure Git once to avoid CRLF/LF confusion:
git config --global core.autocrlf input # recommended in WSL/macOS/Linux
git config --global init.defaultBranch main
Add a .gitattributes
to normalize endings:
* text=auto
*.qmd text eol=lf
*.R text eol=lf
*.md text eol=lf
*.yml text eol=lf
1.1.5 Terminal quickstart by OS
- macOS: Open Terminal (or iTerm2). You are in a Unix shell. Commands from the book work as-is.
- Linux: Open your terminal (GNOME Terminal, Konsole, etc.). You are already in a Unix shell.
- Windows (WSL): Open the Ubuntu app (WSL). You are now in a Linux shell that matches macOS/Linux.
Here are several commonly used shell commands:
cd
: change directory;..
means parent directory.pwd
: present working directory.ls
: list the content of a folder;-l
long version;-a
show hidden files;-t
ordered by modification time.mkdir
: create a new directory.cp
: copy file/folder from a source to a target.mv
: move file/folder from a source to a target.rm
: remove a file a folder.
1.1.6 Common pitfalls and fixes
- “Command not found” — The program is not installed, or your PATH does not include it.
- Permission denied — You may be in a protected folder; work in your home directory.
- Strange characters in filenames — Avoid spaces and punctuation; stick to letters, numbers, dashes.
- Mixing Windows and WSL paths — Prefer working inside your WSL home. If you must access Windows files, use
/mnt/c/...
.
1.1.7 Hands-on check (to do now)
- Open your terminal (macOS/Linux/WSL).
- Confirm your OS with
uname -a
(orver
in PowerShell).
- Create a course folder and a notes file:
mkdir -p ~/dsda1010/week1
cd ~/dsda1010/week1
echo "Week 1 notes" > notes.txt
ls -l
1.2 Files, folders, and paths
- Home folder: Your personal workspace.
- Absolute vs relative paths:
# absolute (macOS/Linux)
/Users/alex/projects/dsda1010
# absolute (Windows)
C:\Users\alex\projects\dsda1010
# relative (from a project root)
../data/nyc311.csv
- Good habits
- Avoid spaces in file/folder names (
use-kebab-case
). - Keep project files together (R scripts, data, and reports).
- Avoid spaces in file/folder names (
1.3 Extensions and line endings
- Common types:
.qmd
,.R
,.csv
,.tsv
,.parquet
,.md
. - Text vs binary: keep data in text formats when possible.
- Line endings: Git normalizes these; we set
.gitattributes
to help.
1.4 Terminals and shells
Open a terminal and try:
pwd # print working directory
ls # list files
cd .. # move up one directory
mkdir lab # make a folder
cd lab # go into the newly created folder
Use Tab to autocomplete file and folder names.
1.5 Install R, Positron (or RStudio), and Quarto
- Install R from CRAN.
- Install Positron or RStudio Desktop.
- Install Quarto
- Verify:
R --version
quarto --version
In RStudio, create a new Quarto document and render it.
1.6 Your first Quarto project
From a terminal:
mkdir dsda1010
cd dsda1010
# Edit hw-template.qmd
quarto render hw-template.qmd
Open the folder in RStudio and inspect the generated files.
1.7 Troubleshooting checklist
- PATH issues: can the terminal find
R
andquarto
?
- Permissions: can you write to your project folder?
- Antivirus or VPN blocking downloads?