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

# Execute Shell Command

> Executes a shell command and returns its output or background process information.



## OpenAPI

````yaml api-reference/openapi.json post /api/bash/command
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: http://localhost:4242/{computer_name}
    description: Local development server
    variables:
      computer_name:
        default: your-computer-name
        description: Computer name
security: []
paths:
  /api/bash/command:
    post:
      tags:
        - bash
      summary: Execute Shell Command
      description: >-
        Executes a shell command and returns its output or background process
        information.
      operationId: executeCommand
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandParams'
        required: true
      responses:
        '200':
          description: Successfully executed command
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
              example:
                output: |-
                  total 20
                  drwxr-xr-x  3 user  group   96 Mar 10 12:34 .
                status: completed
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
components:
  schemas:
    CommandParams:
      properties:
        command:
          type: string
          title: Command
          description: Shell command to execute
          example: ls -la
      type: object
      required:
        - command
      title: CommandParams
      example:
        command: ls -la
    CommandResponse:
      properties:
        output:
          anyOf:
            - type: string
            - type: 'null'
          title: Output
          description: Command output if available
          example: |-
            total 20
            drwxr-xr-x  3 user  group   96 Mar 10 12:34 .
        process_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Process Id
          description: Process ID if running in background
          example: 1234
        status:
          type: string
          title: Status
          description: 'Command status: ''completed'' or ''background'''
          default: completed
          example: completed
      type: object
      title: CommandResponse
      example:
        output: |-
          total 20
          drwxr-xr-x  3 user  group   96 Mar 10 12:34 .
        status: completed
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````