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

# Site Commands

> Execute custom commands on your sites and manage command history in Loupp

## Overview

Site commands allow you to execute custom shell commands directly on your server from the Loupp dashboard. This feature provides a convenient way to perform maintenance tasks, run scripts, and troubleshoot issues without direct SSH access.

## Command Execution Features

### Core Capabilities

<CardGroup cols={3}>
  <Card title="Custom Commands" icon="terminal">
    Execute any shell command with full server access
  </Card>

  <Card title="Command History" icon="history">
    Track all executed commands with timestamps and outputs
  </Card>

  <Card title="Real-time Monitoring" icon="monitor">
    Monitor command execution status and results
  </Card>
</CardGroup>

### Execution Environment

Commands run in a controlled environment:

<AccordionGroup>
  <Accordion title="Working Directory">
    Commands execute from the site's root directory: `/home/loupp/yourdomain.com`
  </Accordion>

  <Accordion title="User Context">
    Commands run as the `loupp` user with appropriate permissions
  </Accordion>

  <Accordion title="Timeout Limits">
    Commands have a 2-minute timeout to prevent resource exhaustion
  </Accordion>
</AccordionGroup>

## Running Commands

### Basic Command Execution

<Steps>
  <Step title="Access command interface">
    Navigate to your site dashboard and click on the "Commands" tab.
  </Step>

  <Step title="Enter command">
    Type your command in the text area:

    ```bash theme={null}
    # Example commands
    ls -la
    php artisan list
    composer install
    npm run build
    ```
  </Step>

  <Step title="Execute command">
    Use one of these methods to run the command:

    * Click "Run" button
    * Press `Cmd + Enter` (macOS)
    * Press `Ctrl + Enter` (Windows/Linux)
  </Step>

  <Step title="Monitor execution">
    Track command status and view output in real-time.
  </Step>
</Steps>

### Command Input Tips

<AccordionGroup>
  <Accordion title="Multi-line Commands">
    ```bash theme={null}
    # You can enter multi-line commands
    if [ -f "composer.json" ]; then
        composer install --no-dev
    else
        echo "No composer.json found"
    fi
    ```
  </Accordion>

  <Accordion title="File Operations">
    ```bash theme={null}
    # Common file operations
    ls -la storage/logs/
    tail -n 50 storage/logs/laravel.log
    chmod -R 755 storage/
    ```
  </Accordion>
</AccordionGroup>

## Command History Management

### Viewing Command History

All executed commands are automatically logged with detailed information:

<CardGroup cols={3}>
  <Card title="Command Details" icon="info">
    * Full command text
    * Execution timestamp
    * User who ran the command
  </Card>

  <Card title="Execution Status" icon="check">
    * Running status
    * Success/failure indicators
    * Execution time tracking
  </Card>

  <Card title="Output Results" icon="file-text">
    * Command output
    * Error messages
    * Return codes
  </Card>
</CardGroup>

### Command History Interface

<Steps>
  <Step title="Access history">
    Scroll down to the "Command History" section below the command input.
  </Step>

  <Step title="Review commands">
    Each command entry shows:

    * Command text (clickable to re-run)
    * Execution date and time
    * Relative time (e.g., "2 hours ago")
    * Current status
  </Step>

  <Step title="View details">
    Click "View Details" to see full command output and execution information.
  </Step>
</Steps>

### Reusing Commands

<Steps>
  <Step title="Select previous command">
    Click on any command in the history to automatically populate the input field.
  </Step>

  <Step title="Modify if needed">
    Edit the command before execution if you need to make changes.
  </Step>

  <Step title="Execute modified command">
    Run the command with your modifications.
  </Step>
</Steps>

## Common Use Cases

### Laravel Application Commands

<AccordionGroup>
  <Accordion title="Artisan Commands">
    ```bash theme={null}
    # Cache management
    php artisan config:cache
    php artisan route:cache
    php artisan view:cache

    # Database operations
    php artisan migrate
    php artisan migrate:rollback
    php artisan db:seed

    # Application maintenance
    php artisan down
    php artisan up
    php artisan optimize
    ```
  </Accordion>

  <Accordion title="Composer Operations">
    ```bash theme={null}
    # Dependency management
    composer install --no-dev --optimize-autoloader
    composer update
    composer dump-autoload --optimize

    # Package operations
    composer require package-name
    composer remove package-name
    ```
  </Accordion>
</AccordionGroup>
