Remote CMD is a lightweight Python CLI + API for managing servers over SSH. Add hosts, run commands, transfer files, and target groups by tags — no Ansible DSL or shell loops required.
| Feature | remote-cmd |
ssh + shell |
Ansible | Fabric |
|---|---|---|---|---|
| Host CRUD + tag groups | ✅ Built-in | ❌ Manual | ✅ Inventory | ❌ |
| Batch commands across hosts | ✅ batch-run |
❌ Write a loop | ✅ Playbook | ✅ |
| File transfer (upload/download) | ✅ Built-in | ✅ scp | ✅ copy module | ✅ |
| Python API | ✅ from remote_cmd import ... |
❌ | ❌ YAML-only | ✅ |
| Zero setup | ✅ pip install → go | ❌ Config SSH | ❌ ansible.cfg | ❌ |
| Learning curve | Low | Low | High | Medium |
Use remote-cmd when you need a CLI that works immediately for ad-hoc SSH tasks. Use Ansible when you need full configuration management and idempotent playbooks.
# 1. Install
pip install remote_cmd_manager
# 2. Add a server
remote-cmd host add web-01 192.168.1.10 ubuntu --key ~/.ssh/id_rsa
# 3. Run a command
remote-cmd run web-01 "uptime"
# 4. Run across all production servers
remote-cmd batch-run -t production "df -h /"remote-cmd batch-run -t production "df -h / | tail -1"
# Output:
# ✓ web-01 → /dev/sda1 32G 12G 19G 40% /
# ✓ web-02 → /dev/sda1 32G 28G 3G 90% / ⚠️
# ✗ db-01 → Connection refusedfrom remote_cmd.core.host_manager import HostManager
manager = HostManager("hosts.json")
for host in manager.list_hosts(tag="staging"):
with manager.connect_to_host(host.name) as client:
client.execute("cd /app && git pull")
client.execute("pip install -r requirements.txt")
client.execute_sudo("systemctl restart app", password="sudopass")remote-cmd batch-run -t web "journalctl -xe -n 50 | grep -i error"# Upload new config
scp nginx.conf user@server:/tmp/nginx.conf # or use the upload command
remote-cmd run web-01 "sudo cp /tmp/nginx.conf /etc/nginx/nginx.conf && sudo nginx -t && sudo systemctl reload nginx"Use Remote CMD inside your own scripts and automation:
from remote_cmd.core.ssh_client import SSHClient, ConnectionConfig
config = ConnectionConfig(
hostname="192.168.1.100",
username="ubuntu",
key_filename="~/.ssh/id_rsa",
)
with SSHClient(config) as client:
# Execute commands
result = client.execute("uptime")
print(result.stdout)
# Transfer files
client.upload_file("./local.txt", "/remote/path/file.txt")
client.download_file("/remote/path/file.txt", "./local.txt")
# List remote directory
for entry in client.list_remote_directory("/var/log"):
print(f"{entry['name']}: {entry['size']} bytes")| Category | Details |
|---|---|
| SSH Auth | Password + key file + ssh-agent |
| Commands | Single, multi-line, sudo with password |
| File Transfer | Upload/download via SFTP |
| Host Management | CRUD with JSON/YAML persistence |
| Tag System | Filter hosts by tag (e.g., production, web, db) |
| Batch Ops | Run commands across any host group |
| Connection Test | Ping all hosts and report status |
| Type Safety | Full type annotations + mypy strict |
# From PyPI (recommended)
pip install remote_cmd_manager
# From source
git clone git@github.com:Vae-Scrooge/remote-cmd.git
cd remote-cmd
pip install -e ".[dev]"| Document | Contents |
|---|---|
| API Reference | Full API docs for SSHClient, HostManager, and more |
| Quickstart Tutorial | Step-by-step walkthrough |
| Advanced Tutorial | Batch ops, error handling, production patterns |
| Development Guide | Setup dev environment, contributing |
| Troubleshooting | Common issues and solutions |
| Changelog | Release history |
Beta. The core API is stable. Breaking changes will be communicated via semantic versioning.
Roadmap:
- Async SSH operations (parallel execution)
- Configuration profiles (AWS, GCP, custom)
- Output formatting (JSON, table)
MIT © Vae-Scrooge