# linux.command.run

Runs one command line on a Linux machine over SSH, as the user an ssh credential names: a server or a long-running container the office can reach

# linux.command.run

```
linux.command.run --credential TEXT --run EXPR [--stdin EXPR] [--max-output SIZE] → command
```

Runs one command line on a Linux machine over SSH, as the user an `ssh` credential names: a server or a long-running container the office can reach. The credential pins the machine's host key, so a machine answering with another key is refused, and may list the programs a line may start with. What the command may touch is that Linux user's own permissions. `--stdin` sends text to the command (a file is written with `--run "cat > notes.txt"`). `out` adds `command: { ok, exit_code, stdout, stderr, duration_ms, truncated }`; a non-zero exit is `ok: false`, while a refused line, an unreachable machine, a changed host key or the `--timeout` fails the node.

## Flags

- `--credential` (required): The ssh credential: which machine, as which user.
- `--run` (required): The command line the user's shell runs.
- `--stdin`: Text sent to the command's standard input.
- `--max-output`: Bytes kept of stdout and of stderr: 1MB by default, at most 16MB.

## Examples

### Ask a machine which Bun it has

```
| linux.command.run --credential compute-1 --run "bun --version"
```

It answers:

```json
{
  "command": {
    "ok": true,
    "exit_code": 0,
    "stdout": "1.4.4\n",
    "stderr": "",
    "duration_ms": 412,
    "truncated": false
  }
}
```

### Write a file from the payload

```
| linux.command.run --credential compute-1 --run "cat > notes.txt" --stdin "{{ input.webhook.body.text }}"
```
