# Administering Joomla from the command line

> Use Joomla's built-in command-line scripts to purge cache, check for updates, remove old files and manage Smart Search indexing.

Source: https://helpcenter.ruachost.com/apps/joomla/administering-joomla-from-the-command-line/

Joomla includes several **command‑line interface (CLI) applications** that allow administrators to automate tasks without logging into the web interface. On **ruachost.com**, these scripts can be run manually or scheduled with cron jobs to streamline site management.

## Why Use the Command Line?

- Automates repetitive tasks such as cache cleanup and indexing.
- Saves time by running scripts directly without using the Joomla admin panel.
- Useful for advanced administrators managing multiple sites.

## Available Joomla CLI Applications

### 1. Purging Expired Cache Files

- Script: `garbagecron.php`
- Removes expired cache data to reduce disk usage.
- Example command:

  ```bash
  cd ~/public_html/cli
  php garbagecron.php
  ```

### 2. Checking for Extension Updates

- Script: `update_cron.php`
- Downloads update information for installed extensions.
- Example command:

  ```bash
  cd ~/public_html/cli
  php update_cron.php
  ```

### 3. Deleting Old Files After an Update

- Script: `deletefiles.php`
- Cleans up leftover files after Joomla updates.
- Example command:

  ```bash
  cd ~/public_html/cli
  php deletefiles.php
  ```

### 4. Managing Smart Search Indexing

- Script: `finder_indexer.php`
- Updates or rebuilds the Smart Search index.
- Example commands:

  ```bash
  cd ~/public_html/cli
  php finder_indexer.php
  php finder_indexer.php --purge
  ```

## Writing Custom CLI Applications

- Joomla provides a **Framework** for building custom PHP CLI scripts.
- Developers can extend Joomla functionality by writing scripts for specific tasks.
- More information: Joomla Framework.

## Important Notes

- These scripts are located in the `cli` directory of your Joomla installation.
- If Joomla is installed in a subdirectory, navigate to that directory first.
- Always back up your site before running or modifying CLI scripts.
- Cron jobs can be configured to run these scripts automatically.
