---
title: CLI Reference
description: Complete reference for all XBP CLI commands
---
Complete reference for all XBP commands, options, and flags.
Available for all commands:
Enable debug mode with verbose output.
```bash
xbp --debug diag
```
List PM2 processes (shorthand).
```bash
xbp -l
```
Filter by port number (for ports command).
```bash
xbp -p 3000
```
System diagnostics and health checks.
```bash
xbp diag [--nginx] [--ports <PORTS>] [--no-speed-test]
```
**Options:**
- `--nginx` - Check only Nginx
- `--ports <PORTS>` - Check specific ports (comma-separated)
- `--no-speed-test` - Skip internet speed test
[Full Documentation](/docs/commands/diag)
Run single health check.
```bash
xbp monitor check
```
Start monitoring daemon.
```bash
xbp monitor start
```
[Full Documentation](/docs/commands/monitor)
Tail log files.
```bash
xbp tail [--kafka] [--ship]
```
**Options:**
- `--kafka` - Tail from Kafka topic
- `--ship` - Ship logs to Kafka
[Full Documentation](/docs/commands/tail)
List and manage network ports.
```bash
xbp ports [-p <PORT>] [--kill] [-n] [--no-local]
```
**Options:**
- `-p, --port <PORT>` - Filter by port
- `--kill` - Kill processes on port
- `-n, --nginx` - Show only Nginx ports
- `--no-local` - Exclude connections where LocalAddr equals RemoteAddr
[Full Documentation](/docs/commands/ports)
List all services.
```bash
xbp services
```
Run service command.
```bash
xbp service build api
xbp service install frontend
xbp service start worker
xbp service dev api
```
**Commands:**
- `build` - Build the service
- `install` - Install dependencies
- `start` - Start the service
- `dev` - Run in development mode
- `stop` - Stop the service
Redeploy services.
```bash
xbp redeploy xbp redeploy api ```
Remote deployment.
```bash
xbp redeploy-v2 -u <USER> -h <HOST> -d <DIR> [-p <PASSWORD>]
```
**Options:**
- `-u, --username <USER>` - SSH username
- `-h, --host <HOST>` - SSH host
- `-d, --project-dir <DIR>` - Project directory
- `-p, --password <PASSWORD>` - SSH password (optional)
Setup reverse proxy.
```bash
xbp nginx setup --domain <DOMAIN> --port <PORT>
```
**Options:**
- `-d, --domain <DOMAIN>` - Domain name
- `-p, --port <PORT>` - Port to proxy to
List Nginx configurations.
```bash
xbp nginx list
```
Update Nginx configuration.
```bash
xbp nginx update --domain <DOMAIN> --port <PORT>
```
List PM2 processes.
```bash
xbp list
```
View service logs. With the `docker` feature enabled, `PROJECT` may be a Docker container name or ID prefix; matching containers stream via `docker logs -f` (sudo fallback). Otherwise PM2 logs are shown.
```bash
xbp logs xbp logs api ```
**Options:**
- `--ssh-host <HOST>` - SSH host to stream remote logs from.
- `--ssh-username <USER>` - SSH username for the remote server.
- `--ssh-password <PASSWORD>` - SSH password for the remote server.
View configuration.
```bash
xbp config
```
Initial setup.
```bash
xbp setup
```
Make HTTP request.
```bash
xbp curl https://api.example.com/health
```
Install package.
```bash
xbp install docker
xbp install nginx
xbp install grafana
```
Generate systemd service units from the current `.xbp/xbp.yaml`.
```bash
xbp generate systemd [--service <SERVICE>] [--output-dir /etc/systemd/system]
```
**Options:**
- `--service <SERVICE>` - Only emit the unit for a single service name.
- `--output-dir <DIR>` - Write units to a custom directory (default `/etc/systemd/system`).
> Running this command on Linux usually requires root privileges when targeting `/etc/systemd/system`. Review the generated files before enabling them with `systemctl daemon-reload` and `systemctl enable`.
```bash
xbp diag && xbp service build api && xbp service start api
```
```bash
xbp monitor check || echo "Health check failed"
```
```bash
xbp monitor start &
xbp tail --ship &
```
Start XBP in API mode.
```bash
export PORT_XBP_API=8080
xbp
```
Set logging level.
```bash
export RUST_LOG=debug
xbp diag
```
Enable debug mode.
```bash
export XBP_DEBUG=1
xbp services
```
- `0` - Success
- `1` - General error
- `2` - Configuration error
- `3` - Network error
- `4` - Service error
```
[component] message
```
```
[component] Success message
```
```
[component] Warning message
```
```
[component] Error message
```
```bash
xbp diag > diagnostics.txt
```
```bash
xbp monitor check >> health-checks.log
```
```bash
xbp tail | grep ERROR
```
```bash
xbp ports | wc -l
```
```bash
if xbp monitor check; then
echo "Service is healthy"
exit 0
else
echo "Service is down"
xbp service start api
exit 1
fi
```
```python
import subprocess
import sys
result = subprocess.run(['xbp', 'monitor', 'check'],
capture_output=True)
if result.returncode == 0:
print("Health check passed")
else:
print("Health check failed")
sys.exit(1)
```
```javascript
const { exec } = require('child_process');
exec('xbp monitor check', (error, stdout, stderr) => {
if (error) {
console.error('Health check failed');
process.exit(1);
}
console.log('Health check passed');
});
```
Create shortcuts for common commands:
```bash
alias xd='xbp diag'
alias xm='xbp monitor check'
alias xl='xbp tail'
alias xp='xbp ports'
alias xs='xbp services'
```
```bash
eval "$(xbp --completion bash)"
```
```bash
eval "$(xbp --completion zsh)"
```
```bash
xbp --completion fish | source
```
1. **Use `--debug`** for troubleshooting
2. **Pipe to `jq`** for JSON formatting
3. **Combine with `watch`** for monitoring
4. **Use `&&` and `||`** for conditional execution
5. **Create aliases** for frequent commands
6. **Save output** for later analysis
7. **Use environment variables** for configuration
```bash
xbp diag
xbp service dev api
xbp tail
```
```bash
xbp diag
xbp service build api
xbp service start api
xbp monitor start
```
```bash
xbp diag --debug
xbp ports -p 3000
xbp logs api
xbp monitor check
```
```bash
xbp monitor start &
xbp tail --ship &
watch xbp ports
```
- [Configuration Guide](/docs/configuration)
- [Installation Guide](/docs/installation)
- [Command Documentation](/docs/commands/diag)
- [Guides](/docs/guides/monitoring)