Why Linux, WSL2 & Remote Environments
Last reviewed
IntermediateWhat you'll learn
~25 min- Explain why Linux, WSL2 and macOS are often smoother for development than native Windows, and when staying on Windows is the right call
- Install WSL2 on Windows and move files between Linux and Windows
- Use GitHub Codespaces as a zero-install Linux environment in the browser
- Connect to a remote server with SSH and keep work running with tmux
- Set environment variables in Bash/Zsh and in PowerShell
By the end of this lesson, you will know why many developers prefer a Linux-style environment, how to get one on any computer (or decide you do not need one yet), and where your commands actually run.
All four tools in this course (Claude Code, Codex CLI, Antigravity, and Copilot CLI) install and run natively on Windows, and the desktop apps need no terminal at all. If you are happy in a desktop app or in PowerShell, you can stay there for the whole course and skim this lesson. Read on when you want to see what Linux offers.
Why Linux, WSL2, and macOS feel smoother for development
Linux and macOS are both Unix-style systems, and WSL2 (Windows Subsystem for Linux) runs a real Linux system inside Windows. Many developers work in one of these three, for practical reasons:
- File-heavy work runs faster. An agent constantly runs
git, installs packages, and runs tests, touching thousands of small files. Linux file systems handle that with less overhead than NTFS plus real-time antivirus scanning (WSL file systems guide). - Containers are native. Docker is built on Linux; on Windows it runs through WSL2 anyway.
- Agent sandboxing. Claude Code’s OS-level sandbox (the
/sandboxcommand) works on macOS, Linux, and WSL2, but not on native Windows. This varies by tool: Codex CLI ships its own native Windows sandbox. - Your laptop matches the server. Most cloud servers and CI pipelines run Linux, so what works locally works after deployment.
- Docs work as written. Most install one-liners and tutorials assume a Unix-style shell.
Native Windows is not a second-class path. The Terminal Commands Reference shows PowerShell forms where they differ, a Dev Drive speeds up file-heavy work, and you can add WSL2 any time.
The mental model: local vs remote
When you type a command, it runs wherever your terminal is connected to, not necessarily on the machine you’re looking at.
It’s like a phone call: if you ask a friend to turn on the TV, the TV in their house turns on. Over SSH you type on your keyboard, but the commands run on the remote machine.
| Concept | What it means | Example |
|---|---|---|
| Local | Commands run on the computer in front of you | Your laptop (macOS Terminal or Windows PowerShell) |
| WSL | A Linux system running inside Windows | Ubuntu on your Windows machine |
| Remote (SSH) | Commands run on a server somewhere else | A university cluster, cloud VM, or work server |
If you’re connected to a server, ls shows files on that server, not your laptop. When unsure, run the “Where Am I?” check from Lesson 4.2: whoami, hostname, pwd. All three work in Bash, Zsh, and PowerShell.
🧬In Your Field: Biotechclick to expand
University research often runs heavy jobs on an HPC (High-Performance Computing) cluster. You SSH in from your laptop, submit jobs, and check results, and the output lives on the cluster, not your laptop. Running hostname confirms you’re on the right system before you process a large dataset.
Option 1: WSL2 on Windows
WSL2 gives you a real Ubuntu Linux terminal inside Windows, side by side with your normal Windows apps.
Install it
- Click Start, type PowerShell, right-click Windows PowerShell, and choose Run as administrator.
- Type this and press Enter:
Terminal window wsl --install - Restart your computer when asked. (Bookmark this page first.)
- After the restart, Ubuntu opens and finishes setting up. If it does not, open Ubuntu from the Start menu.
WSL2 needs hardware virtualization, which is on by default on most modern PCs; if the install says it is disabled, ask IT or check the PC maker’s instructions.
Create your Linux user
Ubuntu asks for a new username and password. These are for Linux only and do not need to match your Windows login.
When Ubuntu asks for a password, nothing appears as you type, not even dots. Your keystrokes still count. Type it, press Enter, and type it again to confirm. Every sudo prompt behaves the same way.
Linux files and Windows files
Your Linux home folder (~, short for /home/yourname) lives inside WSL. Your Windows drive is still reachable from Linux:
| You want to… | Do this in the Ubuntu terminal |
|---|---|
| Work on a project at full speed | Keep it in your Linux home, for example ~/projects |
| Reach a file in your Windows Downloads folder | cd /mnt/c/Users/YourName/Downloads |
| See the current Linux folder in File Explorer | explorer.exe . |
| Open the current folder in VS Code | code . (needs the VS Code WSL extension) |
Projects under /mnt/c/... still work, but run noticeably slower. Keep active projects in ~.
Option 2: VS Code as your cockpit
VS Code (Visual Studio Code) is a code editor with a file explorer, a built-in terminal, and the ability to connect to WSL or remote machines, all in one window, on Mac, Windows, and Linux.
-
Download it from code.visualstudio.com and install it.
-
Press Ctrl+` (backtick, the key above Tab) or choose View, then Terminal. A terminal panel appears at the bottom.
-
In that terminal, go to your practice folder and open it in the sidebar, one line at a time:
Terminal window cd ~/ai-classcode .The
.means “the folder I’m in right now”. You can also use File, then Open Folder.
On Windows with WSL: in the terminal dropdown (the arrow next to the + icon), choose Ubuntu (WSL). To make it the default, open Settings (Ctrl+,), search for terminal default profile windows, and pick Ubuntu (WSL). If you prefer PowerShell, leave the default as it is.
Option 3: GitHub Codespaces, Linux in your browser
GitHub Codespaces is a real Ubuntu machine running VS Code in your browser, with nothing to install, so the Linux installers for all four CLIs work as on a local Linux machine. It runs on any computer with a browser, including Chromebooks and lab machines.
- Go to github.com/codespaces and sign in.
- Click New codespace and choose a blank template or your instructor’s template repository.
- Wait a minute or so. VS Code opens in your browser with a Linux terminal at the bottom.
whoami # Shows your Linux user (often 'codespace')pwd # Shows your project folder inside the codespace- Needs a free GitHub account; free hours vary by plan (see your billing settings)
- Some campus or corporate networks block github.com
- Idle codespaces are eventually deleted, so push your work to a Git repository
📊In Your Field: MIS / Businessclick to expand
On shared university computers where you can’t install anything, Codespaces gives you one personal environment that follows you from the lab to your laptop, and your professor can provide a template repository with the course tools.
Option 4: SSH, connecting to a remote server
If your instructor or employer gives you a remote Linux server (university cluster, cloud VM, training environment), you connect with SSH (Secure Shell), from macOS Terminal, Linux, WSL, or PowerShell: ssh yourname@server.example.edu. Once connected, every command runs on that machine, and your files stay there after you disconnect.
🔍SSH step by step: VS Code Remote SSH, keys, and port forwardingclick to expand
After ssh yourname@server.example.edu, you’re asked for your password (or SSH uses your key). Confirm where you are with hostname (the server’s name, not your laptop) and pwd (your home folder on the server).
From VS Code (recommended): install the Remote - SSH extension, press Ctrl+Shift+P (Cmd+Shift+P on Mac), run Remote-SSH: Connect to Host, and enter yourname@server.example.edu. A new window opens on the server. When you start a web server there (like npm run dev), VS Code offers to forward the port to your local browser, and it reconnects on its own when your network returns.
SSH keys let you connect without typing a password each time. On your local machine, run:
ssh-keygen -t ed25519 -C "your-email@example.com"Accept the default location, optionally set a passphrase, then copy the key to the server (macOS, Linux, WSL):
ssh-copy-id yourname@server.example.eduPowerShell has no ssh-copy-id: run it in WSL, or append your id_ed25519.pub to ~/.ssh/authorized_keys on the server.
Port forwarding without VS Code: ssh -L 8080:localhost:8080 yourname@server.example.edu maps port 8080 on the server to port 8080 on your laptop, so localhost:8080 in your browser shows what the server is serving.
SSH keys are not API keys: an SSH key opens a machine, an API key opens a service.
🏛️In Your Field: Government Devclick to expand
Government networks often require a VPN before SSH, plus keys, jump hosts, or non-standard ports; IT provides the details. A typical command:
ssh -i ~/.ssh/agency-key username@dev-server.agency.gov -p 2222-i points to your SSH key file and -p sets a non-standard port (the default is 22). VS Code Remote SSH supports jump hosts through its SSH config file.
tmux: sessions that survive
If your network drops, a plain SSH session ends and its work usually stops. tmux (terminal multiplexer) keeps your terminals running on the machine after you disconnect, and splits one terminal into several, so each pane can hold its own agent session. It runs on Linux, macOS, and WSL.
🔍tmux keys and a typical sessionclick to expand
Install it with sudo apt install tmux on Ubuntu or WSL, or brew install tmux on macOS.
| Action | Keys or command |
|---|---|
| Start a new session | tmux |
| Detach (leave it running) | Ctrl+B, then D |
| Reattach later | tmux attach |
| New window (like a tab) | Ctrl+B, then C |
| Split the screen side by side | Ctrl+B, then % |
| Split the screen top and bottom | Ctrl+B, then " |
| Move between panes | Ctrl+B, then an arrow key |
“Then” means: press Ctrl+B together, let go, then press the next key. A typical pattern on a server: run tmux, start a long task, detach, close your laptop, and later run tmux attach to find it still running.
Subagents and Orchestration covers running several agents in parallel safely.
The course author’s setup
My own setup is a Linux terminal with a handful of CLI agents running at the same time, each in its own tmux window or pane. Being able to glance across them, steer one while another finishes, and detach from the whole set at the end of the day has sped up my work more than any other change I have made. That is my preference, not a requirement: the desktop apps, PowerShell on Windows, and a Linux terminal all lead to the same place, which is using agentic AI well in your own work. Move at whatever speed, and with whatever tools, feel right to you.
🔍More options: browser terminals and your own cloud machineclick to expand
Google Cloud Shell (shell.cloud.google.com) is a free Linux terminal in your browser, good for practising this module’s commands. It has an idle timeout, a weekly quota, and a small persistent home folder, so treat it as a practice sandbox. See the Cloud Sandbox Cheat Sheet for current specs.
Your own cloud VM (Azure, AWS, DigitalOcean, Google Cloud) gives you an always-on Linux machine you reach over SSH; students often get free credits. Ask a browser chat or your agent to walk you through creating the cheapest current Ubuntu LTS machine that runs Node.js and AI CLI tools. Cloud VMs charge by the hour, so stop (deallocate) yours when you’re done, or set an auto-shutdown schedule.
Which option should I use?
| Situation | Recommended setup |
|---|---|
| Mac laptop | Terminal.app or VS Code’s terminal (you’re already on a Unix-style system) |
| Windows, comfortable in PowerShell | PowerShell in Windows Terminal or VS Code; add WSL2 later if you want it |
| Windows, want the Linux experience | WSL2 + VS Code with the WSL extension |
| No admin rights, or a lab computer | PowerShell (most tools install without admin), GitHub Codespaces, or SSH to a campus server |
| Government-issued machine | Ask IT about approved environments; Codespaces or SSH if available |
You're SSH'd into a university server and run `ls`. What files do you see?
Environment variables and API keys
When an AI CLI tool uses an API key, you usually provide it through an environment variable: a sticky note every program started from that terminal session can read. The syntax depends on your shell:
Bash or Zsh (macOS, Linux, WSL, Codespaces):
export ANTHROPIC_API_KEY="sk-ant-your-key-here"echo $ANTHROPIC_API_KEYPowerShell (Windows):
$env:ANTHROPIC_API_KEY="sk-ant-your-key-here"echo $env:ANTHROPIC_API_KEYA variable set this way lasts only for that terminal session; a new tab starts without it. Saving keys permanently comes later. Never share API keys in chat, email, or unencrypted files.
Pasting a key differs by terminal (Cmd+V on macOS, Ctrl+V or right-click in Windows Terminal, Ctrl+Shift+V on Linux; the Keyboard Shortcuts cheat sheet has the full table). In a prompt that hides input, nothing appears; paste once and press Enter.
When Things Go Wrong
Use the Symptom → Evidence → Request pattern: describe what you see, paste the error, then ask for a fix.
Preflight checklist
Before moving on, confirm these work in your chosen environment. All five work in Bash, Zsh, and PowerShell:
whoami # Shows your usernamehostname # Shows your machine nameecho "Hello!" # Prints textls # Lists filespwd # Shows current directoryKey takeaways
- Native Windows with PowerShell is fully supported for every tool in this course. Linux, WSL2, and macOS add faster file-heavy work, native containers, broader agent sandboxing, and parity with servers.
- WSL2 is one admin command plus a restart. Keep projects in
~; Windows files are at/mnt/c/Users/YourName. - Commands run wherever your terminal is connected to. Run
whoamiandhostnamewhen unsure. - GitHub Codespaces is zero-install Linux in the browser; SSH (ideally through VS Code Remote SSH) connects you to servers.
- tmux keeps sessions alive after you disconnect and lets you run several agents side by side.
- Environment variables use
export NAME=valuein Bash/Zsh and$env:NAME="value"in PowerShell, and last for one session.
🔍Device flow authentication for SSH environmentsclick to expand
On a remote server you can’t open a browser, so some tools (like gh auth login) use device flow: the tool shows a URL and a code such as ABCD-1234, you open the URL on your laptop or phone, enter the code, and approve. The tool on the server is then signed in.
What’s next
You now have a working terminal, you can move around the filesystem, read the file commands an agent runs, and reach Linux whenever you want it. Next up in Module 6: take the agent you installed in Lesson 1.2 deeper, with its modes, permissions, project memory, and the switch between the desktop app and the CLI.