Remote Environments & VS Code
What you'll learn
~20 min- Understand the difference between local, WSL, and remote environments
- Install and configure VS Code as your primary development cockpit
- Connect to remote servers using SSH
- Use GitHub Codespaces as a browser-based development environment
- Choose the right environment for your situation
By the end of this lesson, you will have a working development environment set up — whether that’s VS Code on your laptop, VS Code connected to a remote server, or a cloud-based Codespace. You’ll also understand where your commands run, which prevents real confusion later.
Why this lesson exists
Here’s the reality: most LLM CLI tools run best in a Linux environment. But most of you aren’t sitting in front of a Linux computer. You’re on a Mac laptop, a Windows machine, a university lab workstation, or a government-issued device.
That’s fine. You have several ways to get to a Linux shell, and this lesson covers all of them. This is not a detour — Linux is where cloud infrastructure, CI/CD pipelines, and production servers live. The commands you learn here transfer directly to every professional development environment you’ll encounter. Windows-native support for these tools is improving (see Module 6 for the current state), but WSL gives you the most consistent experience across all four tools.
The mental model: local vs remote
Before we set up anything, internalize this concept. It’s the single most important idea in this lesson:
When you type a command, it runs wherever your terminal is connected to — not necessarily on the machine you’re looking at.
Think of it like a phone call. When you call a friend and say “turn on the TV,” the TV that turns on is in their house, not yours — even though you’re the one speaking. SSH works the same way: you type on your keyboard, but the commands execute on the remote machine.
| Concept | What it means | Example |
|---|---|---|
| Local | Commands run on the computer in front of you | Your laptop |
| 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 |
The key insight: if you’re SSH’d into a server, ls shows files on that server, not your laptop. This is why the “Where Am I?” check matters:
whoami # What user?hostname # What machine?pwd # What directory?Run these whenever you’re unsure. It takes 2 seconds and prevents real confusion.
Quick decision guide:
- Want the fastest start with zero setup? → Use GitHub Codespaces — a full Linux development environment in your browser. It works on any machine (Mac, Windows, Chromebook, lab computer) and you can install Claude Code, Gemini CLI, Codex CLI, and Copilot CLI just like on a local machine.
- Mac? → You’re already set. Open Terminal.app (Applications → Utilities → Terminal). Most CLI tools in this course run natively on macOS.
- Windows? → Install WSL (Windows Subsystem for Linux). It gives you a real Linux terminal inside Windows. See Module 3, Lesson 2 for setup.
- University HPC or remote server? → Use VS Code Remote SSH to connect. Your commands run on the server, but you edit in VS Code on your laptop.
Not sure? Start with GitHub Codespaces — it works everywhere and you can always switch later.
🧬In Your Field: Biotechclick to expand
University research often requires you to run computationally heavy tasks on an HPC (High-Performance Computing) cluster. You’ll SSH into the cluster from your laptop, submit jobs, and check results — all through the terminal. The files live on the cluster, not your laptop. When your PI (Principal Investigator, i.e., your research supervisor) asks “where’s the output?”, the answer is on the cluster at a specific path, not on your local machine. Running hostname helps you confirm you’re connected to the right system before you start processing a large dataset.
Option 1: VS Code — The recommended cockpit
VS Code (Visual Studio Code) is a code editor that gives you a file explorer, a built-in terminal, and the ability to connect to remote machines — all in one window. It’s the single best tool for this course, regardless of your background.
Why VS Code?
- See your files AND type commands in the same window
- Works on Mac, Windows, and Linux
- Connect to remote servers with the Remote SSH extension — edit files on a server as if they were local
- Built-in terminal that matches your environment (WSL on Windows, bash on Mac/Linux)
- Port forwarding — VS Code often auto-detects local servers and can forward ports with one click, letting you view remote web servers in your local browser
Install VS Code
- Go to code.visualstudio.com
- Download for your OS and install
- Open it — you’ll see a welcome tab
Open the integrated terminal
Press Ctrl+` (backtick — the key above Tab) or go to View → Terminal. A terminal panel appears at the bottom. This is where you’ll type all your commands.
On Windows with WSL: VS Code automatically detects WSL. In the terminal dropdown (the + icon), select Ubuntu (WSL) or set it as your default terminal profile in settings.
Open VS Code Settings (Ctrl+,), search for terminal default profile windows, and set it to Ubuntu (WSL). Now every new terminal in VS Code opens in Linux. This means every command you type will work exactly as shown in this course.
Worked example: your first VS Code session
Here’s what a typical first session looks like:
-
Open VS Code
-
Press Ctrl+` to open the terminal
-
Run the “Where Am I?” check:
Terminal window whoami # Your usernamehostname # Your machine namepwd # Your current directory -
Create a project folder:
Terminal window mkdir ~/ai-training && cd ~/ai-training -
Open this folder in VS Code’s file explorer:
Terminal window code .The
code .command opens the current folder in VS Code. Now you can see your files in the sidebar and type commands in the terminal — all in one place. Alternatively, you can use File -> Open Folder in VS Code and select~/ai-training.💡Windows/WSL usersMake sure you have the WSL extension installed in VS Code before running
code .from inside WSL. Without it, the folder may open in the wrong context.
Option 2: SSH — Connecting to a remote server
If your instructor has given you access to a remote Linux server (university cluster, cloud VM, training environment), you connect to it using SSH (Secure Shell).
The mental model for SSH
SSH is like making a phone call to another computer. Once connected, everything you type runs on that remote computer, not yours. When you “hang up” (disconnect), the remote computer keeps existing — your files are still there, ready for next time.
Connecting from your terminal
ssh yourname@server.example.eduYou’ll be asked for your password (or it’ll use your SSH key if configured). Once connected, you’re now running commands on that remote machine.
Verify you’re connected:
hostname # Should show the server's name, not your laptoppwd # Should show your home directory on the serverConnecting from VS Code (recommended)
This is the best way to work remotely — you get the full VS Code experience (file explorer, editor, terminal) while all commands run on the server:
- Install the Remote - SSH extension in VS Code (search “Remote SSH” in the Extensions panel)
- Press Ctrl+Shift+P → type “Remote-SSH: Connect to Host”
- Enter
yourname@server.example.edu - VS Code opens a new window connected to the remote server
- Open a folder, open the terminal — you’re working on the server with the full VS Code experience
When you’re connected via VS Code Remote SSH and start a web server (like python -m http.server 8000 or npm run dev), VS Code automatically detects it and offers to forward the port. You can then open localhost:8000 in your local browser to see the output. No extra setup needed.
🏛️In Your Field: Government / State Devclick to expand
Government networks often require VPN connections before SSH access, and may use specific SSH configurations (key-based auth, jump hosts, restricted ports). Your IT department or project lead should provide connection details. A typical government SSH connection might look like:
ssh -i ~/.ssh/agency-key username@dev-server.agency.gov -p 2222The -i flag specifies your SSH key file, and -p specifies a non-standard port (default is 22). If you need to go through a jump host (bastion), VS Code Remote SSH supports this through its SSH config file — ask your IT team for the exact configuration.
SSH without VS Code
If VS Code isn’t available, you can SSH from any terminal:
ssh yourname@server.example.eduTo view web content you generate on the server, use port forwarding:
ssh -L 8080:localhost:8080 yourname@server.example.eduThis maps port 8080 on the server to port 8080 on your laptop. Start a web server on the remote machine, then open localhost:8080 in your local browser.
Keep your session alive
If you close your laptop or lose network, your SSH session dies and interactive processes usually stop (unless they were started with tmux, screen, or nohup). Two solutions:
- tmux — a terminal multiplexer that keeps your session alive:
Terminal window tmux # Start a new session# ... do your work ...# Press Ctrl+B, then D to detach (session keeps running)tmux attach # Reconnect later - VS Code Remote — reconnects automatically when your network comes back
🔍tmux basics for long-running tasks
tmux is a tool that keeps your terminal session alive even when you disconnect. Think of it as putting your work in a bubble — the bubble stays even if you walk away.
Essential tmux commands:
tmux— start a new sessionCtrl+B, thenD— detach (leave the session running in the background)tmux attach— reconnect to your sessiontmux ls— list all running sessions
This is especially useful when running long tasks (model training, large file processing) on a remote server. Start the task inside tmux, detach, close your laptop, and reconnect later to check the results.
Setting up SSH keys (optional but recommended)
Typing your password every time you SSH becomes slow and repetitive. SSH keys let you connect without a password:
# On your LOCAL machine (not the server), run:ssh-keygen -t ed25519 -C "your-email@example.com"# Press Enter to accept the default file location# Optionally set a passphrase (adds security)
# Copy your key to the server:ssh-copy-id yourname@server.example.eduAfter this, ssh yourname@server.example.edu connects without asking for a password.
ssh-copy-id is not available in standard PowerShell. Run these commands inside your WSL terminal. If ssh-copy-id is unavailable on your system, you can manually append the contents of ~/.ssh/id_ed25519.pub to ~/.ssh/authorized_keys on the server.
SSH keys authenticate you to a server (like a building key card). API keys authenticate you to a service (like a subscription login). You’ll encounter both in this course — SSH keys to connect to machines, and API keys to use AI tools. Don’t confuse them.
Option 3: Google Cloud Shell — Free Browser Terminal
Google Cloud Shell gives you a free Linux terminal in your browser at shell.cloud.google.com. It’s the fastest way to get a zero-install terminal for practicing commands.
When to use it
Cloud Shell is ideal for practicing the terminal commands from Module 3 — ls, cd, mkdir, cat, and everything else — without installing anything. It works on any machine with a browser, including Chromebooks and lab computers.
Setup
- Go to shell.cloud.google.com
- Sign in with your Google account
- A terminal appears — you’re ready to type commands
Limitations
- 20-minute idle timeout — your session disconnects after inactivity (reconnect anytime)
- 50 hours per week — more than enough for learning
- 5 GB persistent home directory — files in
~/survive between sessions - Packages installed outside
~/may not persist across sessions
Cloud Shell is a terminal practice sandbox, not a full development environment. For full project development with CLI tool installation, use Codespaces (next section). See the Cloud Sandbox Cheat Sheet for detailed specs.
Option 4: GitHub Codespaces — Full Dev Environment in Your Browser
GitHub Codespaces gives you a complete Linux development environment in your browser. This is not a limited experience — it is a real Linux machine with a real terminal, running real VS Code, where you can install and run everything in this course.
What it is
A cloud-hosted Ubuntu environment with VS Code, a terminal, file explorer, and pre-installed tools like Node.js and git. You get a real Linux shell with full internet access — no local installation needed. It looks and works exactly like the desktop VS Code app, and you can install Claude Code, Gemini CLI, Codex CLI, and Copilot CLI just like you would on any local Linux machine.
How to use it
- Go to github.com/codespaces
- Click “New codespace”
- Choose a blank template or your instructor’s template repository
- Wait ~30 seconds — a full VS Code opens in your browser
You now have a Linux terminal at the bottom. Install tools exactly as you would on any Linux machine:
node --version # Node.js is pre-installednpm --version # npm toowhoami # Shows your Linux user (often 'codespace')- Requires a GitHub account (free to create)
- Free usage limits vary by GitHub plan and may change — check your GitHub billing settings for current limits
- Network: some university or corporate networks block github.com — check with your instructor
- Data persistence: files persist in your codespace, but codespaces auto-delete after 30 days of inactivity. Push your work to a git repo to save it permanently.
📊In Your Field: MIS / Businessclick to expand
Codespaces can be especially useful for MIS students working on shared university computers where you can’t install anything. You get a consistent, personal environment that follows you across machines — work on the lab computer in class, continue on your laptop at home, same files, same setup. Just log into GitHub from any browser and your codespace is right where you left it. Your professor can also provide a template repository with pre-configured tools for the course.
Option 5: WSL (already set up)
If you followed the Windows instructions in Lesson 2, you already have WSL. You can:
- Open Ubuntu from the Start menu
- Type
wslin any terminal - Use the Ubuntu profile in Windows Terminal
- Set WSL as your default terminal in VS Code
WSL is a real Linux environment. Every command in this course works natively.
Option 6: Your Own Cloud Environment
Your laptop is fine for learning, but for real projects you may want a persistent Linux environment in the cloud — always on, more powerful, accessible from anywhere.
The options
| Provider | Starting price | Notes |
|---|---|---|
| Azure VM | ~$5-20/month | Free credits for students via Azure for Education |
| AWS EC2 | Free tier for 12 months | t2.micro instance is enough to start |
| DigitalOcean Droplet | $6/month | Simple UI, fast setup |
| Google Cloud Compute | Free tier available | $300 free credits for new accounts |
University students: check if your school provides free Azure or AWS credits — many do through programs like Azure for Education or AWS Academy.
The AI shortcut
Once you have a cloud account, you can use browser AI (ChatGPT, Claude, Gemini) to walk you through provisioning. Try a prompt like:
I have an Azure account. Walk me through creating an Ubuntu 22.04 VMI can SSH into for development. I want the cheapest option that canrun Node.js and AI CLI tools.The AI will give you step-by-step instructions including which VM size to pick, how to configure networking, and how to set up SSH access.
Connect with VS Code Remote
Once your VM is running, connect to it with the same VS Code Remote SSH workflow from earlier in this lesson — just point it at your cloud VM’s IP address:
ssh yourname@your-vm-ip-addressCloud VMs charge by the hour. When you’re done for the day, stop (deallocate) your VM from the cloud provider’s dashboard. A running VM you forgot about can cost $20-50/month. Most providers let you set up auto-shutdown schedules.
Which option should I use?
| Situation | Recommended setup |
|---|---|
| Any machine, fastest start | GitHub Codespaces — full Linux environment in your browser, nothing to install |
| Just need to practice terminal commands | Google Cloud Shell — free browser terminal, zero setup |
| Mac laptop | VS Code + built-in terminal (you’re already on Unix) |
| Windows with admin rights | WSL2 + VS Code (set WSL as default terminal) |
| Windows without admin rights | GitHub Codespaces or SSH to a provided server |
| University lab computer | GitHub Codespaces, or SSH into your university’s Linux server + VS Code Remote |
| Government-issued machine | Ask your IT about approved dev environments; Codespaces or SSH if available |
You're SSH'd into a university server and run `ls`. What files do you see?
The clipboard problem
Copying and pasting between your local machine and a remote terminal can be tricky. Here’s a reference for the most common terminals:
| Terminal | How to paste |
|---|---|
| VS Code integrated terminal | Ctrl+V (just works) |
| Windows Terminal (WSL/SSH) | Ctrl+Shift+V or right-click |
| macOS Terminal | Cmd+V |
| PuTTY / traditional SSH clients | Right-click to paste |
| tmux | Use your terminal’s paste shortcut (Ctrl+Shift+V or Cmd+V). Ctrl+B then [ enters tmux copy mode; Ctrl+B then ] pastes from tmux’s internal buffer. |
API key tip: When pasting API keys into a terminal prompt that hides input (like a password field), you won’t see anything appear. That’s normal — it’s hiding the text for security. Just paste and press Enter.
You’ll frequently need to paste API keys (for OpenAI, Anthropic, etc.) into the terminal. The command looks like this:
export ANTHROPIC_API_KEY="sk-ant-your-key-here"If the key is on a different machine (like your phone or a password manager), you can also use VS Code’s settings sync or a secure notes app to transfer it. Never share API keys in chat, email, or unencrypted files.
Environment variables and API keys
Every AI CLI tool needs an API key, and the way you provide it is through environment variables. An environment variable is like a sticky note your terminal can read — you set it once, and every program in that terminal session can see it.
# Set an API key for the current sessionexport ANTHROPIC_API_KEY="sk-ant-your-key-here"
# Verify it's setecho $ANTHROPIC_API_KEY# sk-ant-your-key-hereImportant: This key will disappear when you close the terminal. If you open a new window tomorrow, you will need to run the export command again. We’ll cover how to save keys permanently in a later lesson.
For now, just know that export is how you set environment variables, and the terminal uses them to pass information (like API keys) to programs.
What does the `export` command do in the terminal?
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:
whoami # Shows your usernamehostname # Shows your machine nameecho "Hello!" # Prints textls # Lists filespwd # Shows current directoryIf all five work, your environment is ready. You’ve completed this environment setup lesson and are ready for the next module.
Key takeaways
- VS Code is your recommended cockpit — it combines a file explorer, text editor, and terminal in one window.
- Commands run wherever your terminal is connected to: your laptop (local), WSL (Linux on Windows), or a remote server (SSH).
- Always run
whoamiandhostnameto confirm where you are, especially when working with remote servers. - SSH connects you to remote machines. VS Code Remote SSH gives you the best of both worlds — a visual editor with a remote terminal.
- GitHub Codespaces is a full Linux development environment in the browser — a great starting point if you want zero setup.
- Environment variables (set with
export) are how you pass API keys to AI CLI tools. - Use tmux to keep remote sessions alive when you disconnect.
🔍Device flow authentication for SSH environments
When you’re working on a remote server via SSH, some tools (like GitHub CLI) need to authenticate you. Since you can’t open a browser on the remote machine, they use device flow authentication:
- The tool gives you a URL and a code (like
ABCD-1234) - You open that URL in a browser on your local machine (or phone)
- You enter the code and approve access
- The tool on the remote server is now authenticated
This is common with gh auth login (GitHub CLI), and some AI tools use a similar pattern. When a tool says “open this URL and enter this code,” it’s using device flow — and it works perfectly over SSH because the URL can be opened on any device.
What’s next
You now have a working terminal, you can navigate the filesystem, manage files, and connect to remote environments. That’s the complete foundation. In the next module, we’ll put this foundation to work by installing and configuring your first AI CLI tools.