1 Useful Commands
Matt Cupp edited this page 2026-05-29 17:35:45 -04:00

Useful Commands

Quick reference for common homelab operations.


Proxmox (PVE / PBS)

# List all LXC containers
pct list

# Enter a container shell
pct enter <container_id>

# Run a command in a container without entering it
pct exec <container_id> -- <command>

# Start / stop a container
pct start <container_id>
pct stop <container_id>

# Check container status
pct status <container_id>

# Push a file into a container
pct push <container_id> /path/on/host /path/in/container

# Restore LXC from PBS (as new ID, leaves original intact)
pct restore <new-id> PBS:<datastore>/ct/<orig-id>/<timestamp> --storage <target-storage>

Docker (Nexus)

Docker is installed via snap on Nexus — always use docker compose (space), never docker-compose (hyphen).

# SSH into Nexus first
ssh matt@192.168.1.226

# List running containers
docker ps

# List all containers (including stopped)
docker ps -a

# Follow container logs
docker logs -f <container_name>
docker logs --tail 50 <container_name>

# Enter a running container
docker exec -it <container_name> /bin/bash

# Start / stop a container
docker stop <container_name>
docker start <container_name>

# Redeploy a stack (pulls new image if tag changed)
cd /home/matt/repos/homelab-docker/<service>
docker compose up -d

# Stop a stack
docker compose down

# Follow all logs for a stack
docker compose logs -f

# Check what image tag a container is actually running
docker ps --format "table {{.Image}}\t{{.Names}}"

# Pull a new image without starting it
docker pull <image>:<tag>

Git / Homelab Repo (Nexus)

# SSH into Nexus
ssh matt@192.168.1.226

# Pull latest from Forgejo (also done automatically by Komodo on webhook)
cd /home/matt/repos/homelab-docker
git pull

# Check current state
git status
git log --oneline -10

Renovate

# Trigger a manual Renovate scan (runs immediately instead of waiting for cron)
ssh matt@192.168.1.226 'cd /home/matt/repos/homelab-docker/renovate && docker compose run --rm renovate'

# Watch the Renovate log
ssh matt@192.168.1.226 'tail -f /mnt/server/containers/renovate/renovate.log'

# Check when cron last ran Renovate
ssh matt@192.168.1.226 'grep CRON /var/log/syslog | grep renovate | tail -5'

Komodo

# Manually trigger the full deploy procedure via API
curl -s -X POST "http://192.168.1.226:9120/execute/RunProcedure" \
  -H "x-api-key: <key>" \
  -H "x-api-secret: <secret>" \
  -H "Content-Type: application/json" \
  -d '{"procedure":"<procedure-id>"}'

# Trigger a git pull via API
curl -s -X POST "http://192.168.1.226:9120/execute/PullRepo" \
  -H "x-api-key: <key>" \
  -H "x-api-secret: <secret>" \
  -H "Content-Type: application/json" \
  -d '{"repo":"homelab-docker"}'

# View API docs
curl http://192.168.1.226:9120/docs

# Update Komodo itself (NEVER via its own pipeline — SSH only)
ssh matt@192.168.1.226 'cd /home/matt/repos/homelab-docker/komodo && docker compose up -d'

# Restart Periphery on LXC 113 (Dispatcharr)
ssh root@192.168.1.227 "pct exec 113 -- docker compose -f /opt/komodo/periphery.yml restart"

NUT / UPS

# Check UPS status (run on the NUT master for each UPS)
# Battery Backup 1 (APC) — run on PVE
ssh root@192.168.1.227 'upsc apcups'

# Battery Backup 2 (CyberPower) — run on Nexus
ssh matt@192.168.1.226 'upsc cyberpower@localhost'

# List all UPS devices known to a master
upsc -l

# List available UPS commands
upscmd -l apcups

# Disable APC beeper
upscmd -u upsmon -p <PASSWORD> apcups beeper.disable

# Re-enable APC beeper
upscmd -u upsmon -p <PASSWORD> apcups beeper.enable

# Monitor UPS events live
journalctl -u nut-monitor -f

# Restart NUT on PVE
ssh root@192.168.1.227 'upsdrvctl stop && upsdrvctl start && systemctl restart nut-server && systemctl restart nut-monitor'

# Restart NUT on Nexus
ssh matt@192.168.1.226 'sudo systemctl restart nut-driver && sudo systemctl restart nut-server && sudo systemctl restart nut-monitor'

SOPS / Secrets

# Decrypt a .env.enc backup (disaster recovery)
cd /home/matt/repos/homelab-docker
sops -d --input-type dotenv --output-type dotenv bookstack/.env.enc > bookstack/.env

# Edit an encrypted file in place
sops bookstack/.env.enc

# Re-encrypt after editing the plaintext version
sops --encrypt bookstack/.env > bookstack/.env.enc

Network Diagnostics

# Check IP and routing
ip addr show
ip route

# DNS lookup
nslookup <hostname>
dig <hostname>

# Test connectivity
ping <hostname-or-ip>

# Check open ports on a host
ss -tulpn
netstat -tulpn

# Test if a specific port is open
nc -zv <host> <port>

Storage

# Check disk usage on Nexus
ssh matt@192.168.1.226 'df -h'

# Check Nexus server storage specifically
ssh matt@192.168.1.226 'df -h /mnt/server'

# Check NAS mount
ssh matt@192.168.1.226 'df -h /mnt/nas'

# List Komodo backup dumps
ssh matt@192.168.1.226 'ls -lh /mnt/server/containers/komodo/backups/'