Claude Code WSL Quick Reference

For Windows Users Running Claude Code in WSL

Make This Reference Your Own!

⚡ Quick Start

  1. Fork/Copy: Fork this repo or save this HTML file
  2. Create Private Repo: Make your own private GitHub repository
  3. Enable Pages: Go to Settings → Pages → Deploy from main branch
  4. Customize: Add your own commands with the + button!

✨ Personalization Features

  • Add custom commands with the + button (bottom right)
  • Set your Windows & WSL usernames for accurate paths
  • All settings save in your browser automatically
  • Your customizations persist on your own copy!
⚠️ Note: This is the public read-only version. Fork it to save your personal commands and customizations!
Terminal (WSL/Linux)
PowerShell (Windows)
Claude Chat Commands
Claude Code Performance: Work in WSL home directory!
/mnt/c/ is 30-50x slower than native WSL filesystem. Use /mnt/c/ only for file transfers.
✅ Fast: ~/projects/ ❌ Slow: /mnt/c/Users/...

Prompts & AI Commands

Save your frequently used prompts here for quick access. These are examples to get you started - click the + button to add your own!

Example Claude Prompts

Analyze this codebase and create a comprehensive README Generate project documentation
Refactor this function to be more efficient and add error handling Improve code quality
Create unit tests for this component with edge cases Generate comprehensive tests
Add Your Own Prompts:
  • Click the + button and select "Prompts & AI Commands"
  • Save prompts you use frequently
  • Build your personal prompt library

WSL-Windows Integration

Commands for bridging between your Windows files and WSL Linux environment. Remember: work in WSL home for speed!

Use /mnt/c/ ONLY for file transfers - work in /home/ for performance!

Quick File Transfers Only

cd /mnt/c/Users/YourWindowsUsername Go to Windows user folder
cd /mnt/c/Users/YourWindowsUsername/Desktop Go to Windows Desktop
cd /mnt/c/Users/YourWindowsUsername/Downloads Go to Windows Downloads
explorer.exe . Open current folder in Windows Explorer

Path Conversion

wslpath -w /home/YourWSLUsername/project Convert WSL path to Windows path
wslpath -u "C:\Users\YourWindowsUsername\file.txt" Convert Windows path to WSL path
echo "text" | clip.exe Copy to Windows clipboard
pwd | clip.exe Copy current path to clipboard

Windows Programs from WSL

code . Open VS Code in current directory
notepad.exe filename.txt Open file in Windows Notepad
cmd.exe /c dir Run Windows CMD commands
powershell.exe -c "Get-ChildItem" Run PowerShell commands
wslview https://example.com Open URL in Windows browser
wslview index.html Open local HTML file in browser

Claude Code Best Practices

Essential setup tips for optimal Claude Code performance in WSL. These practices prevent common issues Windows users face.

Setting Up Your Workspace

cd ~ Go to WSL home (fast filesystem)
mkdir -p ~/projects Create projects directory in WSL home
cd ~/projects && git clone https://github.com/user/repo.git Clone directly to WSL filesystem

File Transfer Workflow

cp /mnt/c/Users/YourWindowsUsername/Downloads/project.zip ~/projects/ Copy from Windows to WSL home
cd ~/projects && unzip project.zip Extract in WSL filesystem
Safe Editors for WSL Files: VS Code with Remote-WSL, nano, vim. Avoid: Notepad, WordPad (corrupt line endings & permissions)

WSL File Management

Critical commands for safely handling files between Windows and Linux. Avoid corruption by using proper tools and commands.

WARNING: Opening WSL files in Windows can corrupt them! Notepad adds CRLF, breaks permissions, damages symlinks. Use VS Code with Remote-WSL or stay in terminal.

Common Operations

cp /mnt/c/Users/YourWindowsUsername/Downloads/file.txt . Copy from Windows Downloads
dos2unix filename.txt Convert Windows line endings to Unix
chmod +x script.sh Make script executable (common WSL issue)
chmod 755 file.sh Set standard execute permissions

Git Commands

Version control commands for managing your code. Git works the same in WSL as on any Linux system.

Repository Setup

git clone https://github.com/user/repo.git Clone repository
git config --global core.autocrlf false Disable CRLF conversion (WSL recommended)

Basic Commands

git status Check repository status
git diff Show uncommitted changes
git log --oneline View commit history (compact)
git add . Stage all changes
git commit -m "message" Commit with message
git push Push to remote
git pull Pull from remote

Branches & Stashing

git branch List branches
git checkout -b feature-branch Create and switch to new branch
git checkout main Switch to main branch
git stash Temporarily save changes
git stash pop Apply stashed changes

Claude Code Power Words

Special phrases that trigger advanced Claude behaviors. Use these to unlock deeper analysis and parallel processing.

Thinking Modes

think hard about this architecture Triggers deep architectural analysis
ultrathink through this complex problem Maximum depth reasoning mode
think deeply about the implementation Extended implementation planning
reflect carefully on this complex logic Careful logic analysis and review

Sub-Agent Deployment

deploy 3 sub-agents in parallel to research Spawn multiple research agents
use multiple agents to analyze different aspects Parallel multi-perspective analysis

Behavioral Triggers

implement and test with full coverage Activates agentic mode
run without asking for permission Bypass confirmation prompts

Node.js & npm

JavaScript/Node.js package management. NPM is like the Microsoft Store but for code libraries and tools.

Project Setup

npm init -y Initialize package.json quickly
npm install Install dependencies
npm run dev Start development server
npm run build Build for production
npm run test Run tests
npx playwright test Run E2E tests with Playwright
npm run lint Check code style

Package Management

npx create-react-app my-app Run package without installing
npm outdated Check for outdated packages
npm update Update packages to latest
npm cache clean --force Clear npm cache

Claude Code Setup & Project Commands

Initial setup and the powerful CLAUDE.md context system. These files tell Claude about your project's specific rules and structure.

Installation & Setup

npm install -g @anthropic-ai/claude-code Install Claude Code globally
npm update -g @anthropic-ai/claude-code Update Claude Code to latest version
echo "alias quickref='...'" >> ~/.bashrc && source ~/.bashrc Add quickref alias to open this page
cd ~/projects/my-project && claude Navigate to project and launch Claude

CLAUDE.md Context System

echo "# Project instructions" > CLAUDE.md Create empty project context file
#use ES6 modules not CommonJS Add rule to project CLAUDE.md
cat ~/.claude/CLAUDE.md View global instructions
find . -name CLAUDE.md Find all context files
CLAUDE.md Context Loading:
  • ~/.claude/CLAUDE.md - Global instructions (all projects)
  • ./CLAUDE.md - Project root context (loaded at start)
  • ./subfolder/CLAUDE.md - Subdirectory context (also loaded at start)
  • All CLAUDE.md files in project are loaded when conversation begins
  • Use for: API keys locations, coding standards, project structure

Project Overview Commands

summarize this project Get AI summary of entire project
/init Generate project guide in CLAUDE.md
explain the architecture of this codebase Understand project structure

Claude Code & MCP

Model Context Protocol servers extend Claude's abilities. Add GitHub integration, web browsing, and more capabilities.

claude --help Show Claude Code help
claude mcp list List MCP servers
claude mcp add github "npx -y @modelcontextprotocol/server-github@latest" Add GitHub MCP
claude --continue Continue last conversation session
claude --dangerously-skip-permissions Skip all permission prompts (use cautiously)
claude commit Automatic file commits with AI-generated message

Custom Slash Commands

mkdir -p ~/.claude/commands Create global commands folder (not created by default)
echo "Show project status" > ~/.claude/commands/status.md Create /status command (as .md file)
ls ~/.claude/commands/ List all global commands
mkdir -p .claude/commands Create project-specific commands
Custom Commands:
  • .md files → Become slash commands (e.g., status.md → /status)
  • .sh files → Executable scripts (must have chmod +x)
  • Global commands work in all projects
  • Project commands override global ones

Claude Code Chat Interface

Special chat commands and features. Use @ to reference files, ! to run commands, and drag screenshots directly into chat!

Chat Interface Features

!ls -la Run terminal command from chat (prefix with !)
@filename.js Show specific file to Claude
@src/components/ Reference directory contents
Drag & drop screenshot Works from Windows Explorer to WSL!

Claude Code Keyboard Shortcuts

Essential keyboard shortcuts for efficient Claude Code usage. Switch between planning and action modes with Shift+Tab!

Windows Users: Ctrl+Z does NOT undo! It suspends Claude (runs in background). Use 'fg' to resume or 'kill %1' to stop. Check 'jobs' for suspended processes.

Keyboard Shortcuts & Modes

Shift+Tab Cycle: Planning → Auto-accept → Normal
Escape (2x) Access prompt history
Ctrl+C Cancel current operation
Mode Indicators:
  • Planning Mode: Claude explains before acting
  • Auto-accept Mode: Edits apply without confirmation
  • Normal Mode: Standard interaction (default)

Claude Code on Mobile

Yes, you can run Claude Code on your Android phone! Termux provides a full Linux environment without rooting.

Android Users: Get Termux for mobile Linux!

Mobile Development with Termux

pkg install nodejs Install Node.js on Termux
npm install -g @anthropic-ai/claude-code Install Claude Code on your phone!
pkg install git openssh Install Git and SSH
What is Termux?
  • Free Linux terminal for Android (Google Play Store & F-Droid)
  • Full Linux environment - no root required!
  • Run Claude Code, Node.js, Python, Git, SSH & more

PowerShell WSL Management

Control WSL from Windows side. These commands run in PowerShell/Windows Terminal, not inside WSL itself.

Run these from Windows PowerShell/Terminal, not inside WSL!

Essential WSL Controls

wsl --shutdown Restart WSL (fixes many issues)
wsl --list --verbose Show all WSL distros and their status
wsl --terminate Ubuntu Stop specific WSL distro
wsl --update Update WSL to latest version
wsl ~ Open WSL directly in home directory
wsl --set-default Ubuntu Set default WSL distro

Backup & Recovery

wsl --export Ubuntu C:\backup\ubuntu-backup.tar Backup WSL distro
wsl --import Ubuntu-New C:\WSL\Ubuntu-New C:\backup\ubuntu-backup.tar Restore WSL backup

WSL Environment

Check your WSL setup and keep everything updated. Ubuntu in WSL needs regular updates just like any Linux system.

wsl --version Check WSL version
lsb_release -a Check Ubuntu version
sudo apt update && sudo apt upgrade Update WSL packages
which node Check Node.js installation path
echo $PATH View environment PATH

File Operations

Commands for viewing, searching, and analyzing files. The pipe symbol (|) chains commands together for powerful operations.

cat filename Display file contents
grep "pattern" filename Search in file
find . -name "*.js" Find files by pattern
tail -f logfile.log Follow log file output
wc -l filename Count lines in file
dos2unix filename Convert Windows line endings (CRLF) to Unix (LF)

Common Linux Commands

Essential Linux commands including aliases (shortcuts) and Bash history tricks. These make terminal work much faster!

Bash Aliases

alias List all current aliases
alias name Show specific alias definition
alias ll="ls -la" Create new alias (temporary)
echo "alias myalias='command'" >> ~/.bashrc Add permanent alias
source ~/.bashrc Reload bashrc to apply changes
unalias name Remove alias from current session

Bash History Magic!

!! Run the last command again
sudo !! Run last command with sudo (forgot sudo?)
!npm Run last command starting with 'npm'
!$ Use last argument from previous command
history | grep git Search command history
!123 Run command #123 from history

Process Management

ps aux Show all running processes
ps aux | grep node Find specific processes
kill -9 PID Force kill process by ID
pkill -f "process_name" Kill process by name
top Real-time process monitor
htop Better process monitor (if installed)

System Information

df -h Show disk usage
du -sh * Directory sizes in current folder
free -h Show memory usage
history Show command history
history | grep alias Search command history
which command Find location of command

Terminal Management

Control your terminal sessions and processes. Always exit cleanly to avoid zombie processes that eat up resources!

Always exit properly - don't just close the window!

Proper Exit Methods

exit Clean exit from WSL session
logout Alternative clean exit
Ctrl+D EOF signal - same as exit

Process Control

Ctrl+C Stop/kill current process
Ctrl+Z Suspend process (NOT undo! Still running in background!)
fg Resume suspended process
bg Resume process in background
jobs List background/suspended jobs
kill %1 Kill job number 1

Check Before Closing

ps aux | grep $USER See all your processes
ps aux | grep -E "node|npm|python|java" | grep -v grep Check for common dev processes
lsof -i :3000 Check what's using port 3000

Terminal Shortcuts

Ctrl+L Clear screen (same as 'clear')
Ctrl+R Search command history
!! Run last command again
sudo !! Run last command with sudo

Terminal File Managers (MC & tmux)

Visual file management in terminal! MC gives you a Norton Commander-style interface, while tmux enables multiple terminal sessions.

Midnight Commander (MC) Basics

sudo apt-get install mc Install Midnight Commander
mc Launch Midnight Commander
mc -b Launch MC in black and white mode

MC Key Operations

F3 View file (internal viewer)
F4 Edit file (internal editor)
F5 Copy file to other panel
F6 Move/rename file
F7 Create directory
F8 Delete file/directory
F9 Access top menu bar
F10 Exit Midnight Commander

MC Navigation & Selection

Tab Switch between panels
Insert Select/deselect file
+ (plus) Select files by pattern (e.g., *.txt)
- (minus) Deselect files by pattern
Ctrl+O Toggle to full terminal view
Alt+. Show/hide hidden files
Alt+T Cycle through panel view modes

tmux Terminal Multiplexer

sudo apt-get install tmux Install tmux (usually pre-installed)
tmux Start new tmux session
tmux new -s mysession Start named tmux session
tmux ls List all tmux sessions
tmux attach -t mysession Attach to named session

tmux Key Bindings (Ctrl+B is prefix)

Ctrl+B then % Split pane vertically
Ctrl+B then " Split pane horizontally
Ctrl+B then arrow Navigate between panes
Ctrl+B then o Cycle through panes
Ctrl+B then x Kill current pane
Ctrl+B then c Create new window
Ctrl+B then n Next window
Ctrl+B then p Previous window
Ctrl+B then d Detach from session
Ctrl+B then Ctrl+arrow Resize current pane

Combining MC and tmux

tmux new "mc" Start tmux with MC
# Split tmux, run mc in one pane Use Ctrl+B % then run mc in one pane

Python Development

Python development in WSL works great! Virtual environments keep your projects isolated from each other.

Note: Use Unix-style paths in WSL, not Windows paths
python3 -m venv venv Create virtual environment
source venv/bin/activate Activate virtual environment (WSL/Linux)
pip install -r requirements.txt Install dependencies
pytest Run Python tests

Network & Download

Download files directly to WSL and check network connectivity. curl and wget are your download workhorses.

Download Files

curl -O https://example.com/file.zip Download file (keep original name)
curl -o output.zip https://example.com/file.zip Download with custom name
wget https://example.com/file.zip Alternative downloader

Network Testing

ping google.com Test connectivity
curl ifconfig.me Get public IP address
netstat -tuln Show listening ports
ss -tuln Modern port listing (faster)

Text Processing

Powerful text manipulation tools built into Linux. Process logs, CSV files, and text data with these commands.

File Viewing

head -n 20 file.txt Show first 20 lines
tail -n 20 file.txt Show last 20 lines
less filename Page through file (q to quit)

Text Manipulation

sed 's/old/new/g' file.txt Find and replace text
sort filename.txt Sort lines alphabetically
sort -n numbers.txt Sort numerically
uniq sorted.txt Remove duplicate lines
cut -d',' -f1 data.csv Extract first column from CSV
grep "pattern" filename Search for pattern in file
find . -name "*.js" Find files by pattern

Compression & Archives

Create and extract compressed files. TAR is Linux native, ZIP works everywhere including Windows.

TAR Archives

tar -czf archive.tar.gz folder/ Create compressed tar archive
tar -xzf archive.tar.gz Extract tar.gz archive
tar -tf archive.tar.gz List archive contents

ZIP Archives

zip -r archive.zip folder/ Create zip archive
unzip archive.zip Extract zip archive
unzip -l archive.zip List zip contents

SSH & Remote Access

Connect to remote servers securely. SSH keys are more secure than passwords - generate one and never type passwords again!

SSH Connection

ssh user@hostname Connect to remote server
ssh -p 2222 user@host SSH on custom port
ssh-keygen -t rsa -b 4096 Generate SSH key pair
ssh-copy-id user@host Copy SSH key to server

File Transfer

scp file.txt user@host:~/ Copy file to remote
scp user@host:~/file.txt . Copy file from remote
scp -r folder/ user@host:~/ Copy directory to remote