shell-networking
Production-grade shell networking - curl, ssh, ports, debugging
What this skill does
# Shell Networking Skill
> Master networking operations from the command line
## Learning Objectives
After completing this skill, you will be able to:
- [ ] Make HTTP requests with curl
- [ ] Use SSH for remote operations
- [ ] Check ports and connections
- [ ] Debug network issues
- [ ] Transfer files securely
## Prerequisites
- Bash basics
- Basic networking concepts
- Understanding of HTTP
## Core Concepts
### 1. Curl Essentials
```bash
# Basic requests
curl https://api.example.com # GET
curl -X POST https://api.example.com # POST
curl -o file.zip https://example.com/f # Download
# Headers and data
curl -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"key":"value"}' \
https://api.example.com
# Common options
curl -v url # Verbose
curl -s url # Silent
curl -L url # Follow redirects
curl -k url # Skip SSL verify
curl -w "%{http_code}" -o /dev/null -s url
```
### 2. SSH Operations
```bash
# Connect
ssh user@host
ssh -p 2222 user@host
ssh -i ~/.ssh/key.pem user@host
# File transfer
scp file.txt user@host:/path/
scp -r dir/ user@host:/path/
scp user@host:/path/file.txt ./
# Tunnels
ssh -L 8080:localhost:80 user@host
ssh -D 1080 user@host # SOCKS proxy
```
### 3. Port Checking
```bash
# List listening ports
ss -tlnp # TCP
ss -ulnp # UDP
netstat -tlnp # Alternative
# Check specific port
nc -zv host 80 # Port check
lsof -i :8080 # What's using port
# Scan ports
nmap -sT host # TCP scan
nmap -p 80,443 host # Specific ports
```
### 4. DNS Operations
```bash
# DNS lookup
dig example.com
dig +short example.com # IP only
dig example.com MX # MX records
dig @8.8.8.8 example.com # Specific DNS
# Alternatives
host example.com
nslookup example.com
```
## Common Patterns
### API Request with Error Handling
```bash
response=$(curl -s -w "\n%{http_code}" \
-H "Authorization: Bearer $TOKEN" \
"https://api.example.com/data")
http_code=$(echo "$response" | tail -1)
body=$(echo "$response" | sed '$d')
if [[ "$http_code" != "200" ]]; then
echo "Error: HTTP $http_code"
exit 1
fi
```
### Wait for Port
```bash
wait_for_port() {
local host="$1" port="$2" timeout="${3:-30}"
for ((i=0; i<timeout; i++)); do
if nc -z "$host" "$port" 2>/dev/null; then
return 0
fi
sleep 1
done
return 1
}
```
### SSH Config
```bash
# ~/.ssh/config
Host myserver
HostName 192.168.1.100
User admin
Port 2222
IdentityFile ~/.ssh/mykey
```
## Anti-Patterns
| Don't | Do | Why |
|-------|-----|-----|
| `curl \| bash` | Download, inspect, run | Security risk |
| Store passwords | Use SSH keys | More secure |
| Skip SSL verify | Fix certificates | Security |
## Practice Exercises
1. **API Client**: Script to interact with REST API
2. **Health Checker**: Check if services are up
3. **SSH Automation**: Run commands on multiple hosts
4. **Port Scanner**: Simple port availability checker
## Troubleshooting
### Common Errors
| Error | Cause | Fix |
|-------|-------|-----|
| `Connection refused` | Service down | Check if running |
| `Connection timed out` | Firewall/routing | Check network |
| `Name not resolved` | DNS issue | Check DNS |
| `Permission denied (publickey)` | SSH key | Check authorized_keys |
### Debug Techniques
```bash
# Test connectivity
ping -c 2 host
traceroute host
# Debug curl
curl -v https://example.com
# Debug SSH
ssh -vvv user@host
```
## Security Guidelines
1. **Use SSH keys** instead of passwords
2. **Verify SSL certificates** in production
3. **Don't store secrets** in scripts
4. **Use environment variables** for credentials
5. **Audit SSH access** regularly
## Resources
- [curl Manual](https://curl.se/docs/manual.html)
- [SSH Manual](https://man.openbsd.org/ssh)
- [tcpdump Manual](https://www.tcpdump.org/manpages/)
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.