Skip to content

Knightwatch cli

Yousef Ghadiri edited this page Jul 1, 2026 · 1 revision

CLI

knightwatch-cli is a command-line client for talking to a knightwatch server over its REST API — locally or remote.

Install

See Installation — pass --package knightwatch-cli (shell) or -Package knightwatch-cli (PowerShell).

Connecting

knightwatch-cli --url http://localhost:8083 health
Option Env var Default
--url / -u KW_URL http://localhost:8083
--token / -t KW_TOKEN

If the server has auth enabled, log in once and reuse the token:

knightwatch-cli login -u admin -p secret   # prints a bearer token
export KW_TOKEN=<token>

Command groups

Commands mirror the server's API Reference one-to-one:

  • Commonhealth, info, shutdown
  • Authlogin, logout
  • Screenshotscreenshot
  • Processroot-pids, process-tree, top-processes, kill-process, track-pid, poll controls, etc.
  • System resourcessystem, cpu, memory, disks, networks, gpus, battery, set-thresholds, poll controls, etc.
  • Systemdsystemd, unit, failed-units, poll controls, etc.
  • Dockerdocker-containers, container, stop-container, restart-container, poll controls, etc. Command names with commands requiring server flags (e.g. --allow-process-commands) will fail if that feature isn't enabled on the server.

Run knightwatch-cli --help or knightwatch-cli <command> --help for the full list of commands and their arguments.

Clone this wiki locally