# OpenClaw Command Cheat-Sheet

Quick reference for the commands used in this tutorial.

## Install

```bash
# Node.js 22+
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs

# OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw --version
```

## First-time setup

```bash
openclaw onboard --install-daemon      # setup wizard: AI key, Telegram, daemon
```

## Telegram pairing

```bash
openclaw pairing list telegram         # see pending pairings
openclaw pairing approve telegram --notify
```

## Status & health

```bash
openclaw status                        # is the agent running?
openclaw gateway status                # gateway health
systemctl --user status openclaw-gateway.service
```

## Logs

```bash
openclaw logs --follow                 # live logs
openclaw logs                          # recent logs
```

## Keep it alive 24/7

```bash
sudo loginctl enable-linger $USER      # survive logout
```

## Restart / stop / start (systemd user service)

```bash
systemctl --user restart openclaw-gateway.service
systemctl --user stop openclaw-gateway.service
systemctl --user start openclaw-gateway.service
```

## Control UI (via SSH tunnel, from your own computer)

```bash
ssh -L 18789:localhost:18789 root@YOUR_SERVER_IP
# then open http://localhost:18789
```

## Add swap (1 GB droplets)

```bash
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
```

## Firewall basics

```bash
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status
```

## Telegram test

```
/start
hi
```

> Command names can change between OpenClaw versions. If one doesn't work, run `openclaw --help` or check https://docs.openclaw.ai.
