Cross-Platform Workflows
Integrating Windows with Linux environments - WSL, dual-boot, virtualization, and seamless file sharing workflows.
Windows Subsystem for Linux (WSL)
WSL Overview
WSL provides a Linux environment directly within Windows, offering the best of both worlds for developers and system administrators.
| Feature | WSL 1 | WSL 2 | Native Linux |
|---|---|---|---|
| Kernel | Translation layer | Real Linux kernel | Native kernel |
| Performance | Good | Excellent | Excellent |
| File system | Windows integration | Virtual disk | Native |
| Network | Windows network stack | Virtualized | Native |
| Docker support | Limited | Full | Full |
Installing WSL
# Enable WSL feature
wsl --install
# Install specific distribution
wsl --install -d Ubuntu
# List available distributions
wsl --list --online
WSL Management Commands
| Task | Command | Purpose |
|---|---|---|
| List distributions | wsl --list --verbose | Show installed distros |
| Set default | wsl --set-default Ubuntu | Set primary distro |
| Start distro | wsl -d Ubuntu | Launch specific distro |
| Shutdown | wsl --shutdown | Stop all WSL instances |
| Update | wsl --update | Update WSL kernel |
| Export | wsl --export Ubuntu backup.tar | Backup distro |
| Import | wsl --import NewUbuntu C:\WSL backup.tar | Restore distro |
File System Integration
| Access Pattern | Path | Example |
|---|---|---|
| Windows files from WSL | /mnt/c/path | /mnt/c/Users/john/Documents |
| WSL files from Windows | \\wsl$\distro\path | \\wsl$\Ubuntu\home\john |
| WSL home from Windows | \\wsl$\Ubuntu\home\username | Direct access to Linux home |
WSL Networking
- Localhost forwarding: Services in WSL accessible via
localhostfrom Windows - Windows services: Accessible from WSL via Windows IP
- Firewall: Windows Firewall affects WSL network access
WSL Best Practices
- Keep files in WSL: Better performance for Linux tools
- Use Windows files: For sharing with Windows applications
- Git repos in WSL: Better performance and permissions
- Development in WSL: Use WSL for development, Windows for GUI apps
Dual-Boot Configuration
Dual-Boot Options
| Setup Type | Pros | Cons | Best For |
|---|---|---|---|
| Traditional dual-boot | Full performance | Reboot required | Dedicated use cases |
| WSL | Seamless integration | Some limitations | Development work |
| Virtual machine | Isolated, safe | Performance overhead | Testing, learning |
Dual-Boot Considerations
- Disk partitioning: Separate partitions for each OS
- Boot loader: GRUB or Windows Boot Manager
- Time sync: Handle timezone differences
- Shared data: FAT32 or NTFS partition for shared files
File System Compatibility
| File System | Windows | Linux | Shared Access | Notes |
|---|---|---|---|---|
| NTFS | Native | Read/write (ntfs-3g) | Yes | Windows native |
| FAT32 | Native | Native | Yes | 4GB file limit |
| ext4 | WSL/third-party | Native | Limited | Linux native |
| exFAT | Native | Native | Yes | Good for large files |
Boot Manager Configuration
# Update GRUB (Linux)
sudo update-grub
# Add Windows entry to GRUB
sudo os-prober
sudo update-grub
Windows Boot Manager:
# List boot entries
bcdedit /enum
# Set default OS
bcdedit /default {identifier}
# Set timeout
bcdedit /timeout 30
Virtualization Solutions
Virtualization Options
| Solution | Type | Performance | Integration | Best For |
|---|---|---|---|---|
| VirtualBox | Type 2 hypervisor | Good | Basic | Learning, testing |
| VMware | Type 2 hypervisor | Excellent | Advanced | Professional use |
| Hyper-V | Type 1 hypervisor | Excellent | Windows integration | Windows environments |
| Docker | Containerization | Excellent | Development focus | Development, microservices |
Hyper-V (Windows Pro/Enterprise)
# Enable Hyper-V
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
# Create new VM
New-VM -Name "Ubuntu" -MemoryStartupBytes 2GB -Generation 2
Docker on Windows
| Scenario | Solution | Notes |
|---|---|---|
| WSL 2 | Docker Desktop with WSL 2 | Best performance |
| Windows containers | Docker Desktop | Windows-specific containers |
| Hyper-V | Docker Desktop with Hyper-V | Legacy option |
File Sharing & Synchronization
Network File Sharing
| Protocol | Windows | Linux | Use Case |
|---|---|---|---|
| SMB/CIFS | Native | Samba | Windows-centric networks |
| NFS | Client support | Native | Unix-centric networks |
| SSH/SFTP | Third-party tools | Native | Secure file transfer |
| FTP | Built-in client/server | Built-in client/server | Simple file transfer |
Setting Up Samba (Linux → Windows)
# Install Samba
sudo apt install samba
# Configure share
sudo nano /etc/samba/smb.conf
# Add share section
[shared]
path = /home/shared
browseable = yes
writable = yes
guest ok = yes
# Restart Samba
sudo systemctl restart smbd
Accessing from Windows
\\linux-ip-address\shared
Cloud Storage Integration
| Service | Windows Client | Linux Client | Command Line |
|---|---|---|---|
| OneDrive | Native | Third-party | rclone |
| Google Drive | Third-party | Third-party | rclone |
| Dropbox | Native | Native | dropbox-cli |
| Nextcloud | Third-party | Native | nextcloudcmd |
Synchronization Tools
| Tool | Platform | Purpose | Features |
|---|---|---|---|
| rsync | Linux, WSL | File synchronization | Incremental, efficient |
| robocopy | Windows | File copying | Mirror, resume |
| SyncToy | Windows | Folder sync | GUI, automated |
| Unison | Cross-platform | Bidirectional sync | Conflict resolution |
Development Workflows
Git Configuration
WSL/Linux:
# Configure Git
git config --global user.name "Your Name"
git config --global user.email "email@example.com"
# Use credential manager
git config --global credential.helper store
Windows:
# Use Windows Credential Manager
git config --global credential.helper manager-core
SSH Key Management
Generate SSH keys in WSL:
# Generate key
ssh-keygen -t ed25519 -C "your_email@example.com"
# Start SSH agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
Use SSH keys from Windows:
# Share SSH keys between Windows and WSL
ln -s /mnt/c/Users/username/.ssh ~/.ssh
IDE Integration
| IDE | WSL Support | Remote Development | Notes |
|---|---|---|---|
| VS Code | Excellent | WSL extension | Seamless integration |
| IntelliJ | Good | Built-in SSH | Remote development |
| Visual Studio | Limited | SSH support | Windows-focused |
| JetBrains IDEs | Good | Gateway tool | Remote development |
VS Code with WSL
# Install VS Code in WSL
code .
# Install VS Code extensions in WSL
code --install-extension ms-vscode-remote.remote-wsl
Container Workflows
Docker Integration
Docker Desktop with WSL 2:
- Containers run in WSL 2 VM
- Access from both Windows and WSL
- Best performance for Linux containers
Container Development Patterns
| Pattern | Description | Best For |
|---|---|---|
| WSL + Docker | Development in WSL, containers in Docker | Linux-focused development |
| Windows + Docker | Development on Windows, Linux containers | Mixed environments |
| Devcontainers | Development inside containers | Consistent environments |
Example Workflow
# In WSL
git clone https://github.com/user/project.git
cd project
# Build and run container
docker build -t myapp .
docker run -p 8080:8080 myapp
# Access from Windows browser
# http://localhost:8080
Remote Access & Management
Remote Desktop (RDP)
Enable RDP on Windows:
Settings → System → Remote Desktop → Enable
Connect from Linux:
# Install RDP client
sudo apt install remmina
# Or use command line
rdesktop windows-ip-address
SSH on Windows
OpenSSH Server:
# Install OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# Start and enable service
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
Connect from Linux:
ssh username@windows-ip-address
Windows PowerShell Remoting
# Enable PS Remoting
Enable-PSRemoting -Force
# Connect from another Windows machine
Enter-PSSession -ComputerName target-computer
File Format Compatibility
Text Files & Line Endings
| System | Line Ending | Git Config |
|---|---|---|
| Windows | CRLF (\r\n) | core.autocrlf=true |
| Linux | LF (\n) | core.autocrlf=input |
| macOS | LF (\n) | core.autocrlf=input |
Handling Line Endings
# Convert Windows to Unix
dos2unix filename
# Convert Unix to Windows
unix2dos filename
# Git configuration for mixed environments
git config --global core.autocrlf input
Archive Formats
| Format | Windows | Linux | Best For |
|---|---|---|---|
| ZIP | Native | Native | General use |
| 7Z | 7-Zip | p7zip | High compression |
| TAR.GZ | WSL/tools | Native | Linux distributions |
| RAR | WinRAR | unrar | Legacy archives |
Network Configuration
Shared Network Resources
Windows Network Discovery:
Settings → Network & Internet → Advanced network settings → Network discovery
Linux Network Browsing:
# Browse Windows shares
smbclient -L //windows-ip-address
# Mount Windows share
sudo mount -t cifs //windows-ip/share /mnt/point -o username=user
VPN Configuration
| VPN Type | Windows | Linux | Notes |
|---|---|---|---|
| OpenVPN | Client app | Native support | Cross-platform |
| WireGuard | Client app | Native support | Modern, fast |
| IKEv2 | Native | strongSwan | Enterprise |
| PPTP | Native | Native | Legacy, insecure |
Backup & Migration Strategies
Backup Approaches
| Method | Windows Tools | Linux Tools | Scope |
|---|---|---|---|
| System image | Windows Backup | dd, Clonezilla | Full system |
| File backup | File History | rsync, tar | User data |
| Incremental | Windows Backup | rsnapshot | Changed files only |
| Cloud backup | OneDrive | rclone | Offsite storage |
Migration Tools
| Tool | Purpose | Platform | Notes |
|---|---|---|---|
| Windows Easy Transfer | User data migration | Windows | Legacy tool |
| User State Migration Tool | Enterprise migration | Windows | Enterprise focused |
| rsync | File synchronization | Cross-platform | Efficient transfers |
| clonezilla | Disk imaging | Cross-platform | Complete system clone |
Cross-Platform Backup Script
#!/bin/bash
# Backup script that works in WSL and Linux
SOURCE="/mnt/c/Users/username/Documents"
DESTINATION="/backup/windows-docs"
DATE=$(date +%Y%m%d)
# Create timestamped backup
rsync -avh --delete "$SOURCE/" "$DESTINATION-$DATE/"
# Keep only last 7 backups
find /backup -name "windows-docs-*" -type d -mtime +7 -exec rm -rf {} \;
Performance Optimization
WSL Performance Tips
- Keep files in WSL filesystem: Avoid
/mnt/c/for development - Use WSL 2: Better performance than WSL 1
- Limit memory usage: Configure
.wslconfigfile - Disable Windows Defender: For WSL directories (if safe)
Network Performance
- WSL networking: Use
localhostfor forwarded ports - File sharing: SMB3 protocol for better performance
- VPN considerations: May affect WSL networking
Resource Management
# .wslconfig file in %USERPROFILE%
[wsl2]
memory=4GB
processors=2
swap=1GB
localhostForwarding=true
Security Considerations
Cross-Platform Security
- Firewall configuration: Windows Firewall affects WSL
- Antivirus exclusions: Exclude development directories
- SSH key security: Protect private keys across platforms
- File permissions: Different models between systems
Best Practices
- Separate environments: Use VMs for untrusted code
- Regular updates: Keep both systems updated
- Backup verification: Test restore procedures
- Access control: Use appropriate permissions
- Network segmentation: Isolate development networks