> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ns.rocks/llms.txt
> Use this file to discover all available pages before exploring further.

# Bash

> Run shell-oriented notebook cells with the code interpreter Bash kernel.

The standard `code-interpreter` template includes a Bash kernel for shell
workflows that should be captured as notebook-style executions.

<CodeGroup>
  ```python Python SDK theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  result = machine.run_code("""
  pwd
  printf 'hello from bash\n'
  """, language="bash")

  print("".join(result.logs.stdout))
  ```

  ```typescript TypeScript SDK theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  const result = await machine.code.run(`
  pwd
  printf 'hello from bash\n'
  `, { language: "bash" });

  console.log(result.logs.stdout.join(""));
  ```

  ```bash CLI theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  nullspace machine code run mch_123 "pwd
  printf 'hello from bash\n'" --language bash
  ```

  ```bash HTTP API theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
  # returns a Server-Sent Events stream of JSON events
  curl -N -X POST "${NULLSPACE_API_URL}/v1/machines/mch_123/code/execute" \
    -H "Authorization: Bearer ${NULLSPACE_API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{"code": "pwd\nprintf '\''hello from bash\\n'\''", "language": "bash"}'
  ```
</CodeGroup>

For ordinary process execution, prefer `machine.commands.run()`. Use Bash code
interpreter cells when you want the output represented as a code execution with
the same callbacks, results, and artifact handling as other interpreter cells.

## Related

* [Commands](../commands/overview)
* [Streaming](./streaming)
