[Joomla] How to administer Joomla from the command line
About Joomla's CLI applications
Unfortunately, Joomla does not have a complete CLI administration solution like WP-CLI for WordPress or Drush for Drupal. However, Joomla does include some application scripts that you can use to do common administrative tasks from the command line.
Because these applications are PHP scripts, you can run them automatically in cron jobs.
The following sections describe the CLI applications included with Joomla.
Purging expired cache files
You can remove expired cache data by using the garbagecron.php application. By running this application periodically, you can keep the Joomla cache at a manageable size and reduce disk space usage.
To run this application, type the following commands:
cd ~/public_html/cli php garbagecron.php
If you installed Joomla in a subdirectory, change to that directory instead, and then change to the cli directory.
For more information about this application, please visit https://docs.joomla.org/Purging_expired_cache_files.
Checking for extension updates
You can download extension update information by using the update_cron.php application. By running this application periodically, you can make sure that the Joomla administration interface always has up-to-date information about available extension updates.
To run this application, type the following commands:
cd ~/public_html/cli php update_cron.php
If you installed Joomla in a subdirectory, change to that directory instead, and then change to the cli directory.
Deleting old files after an update
You can remove old files that remain after an update by using the deletefiles.php application. By running this application periodically, you can help reduce disk space usage and keep your Joomla installation streamlined.
To run this application, type the following commands:
cd ~/public_html/cli php deletefiles.php
If you installed Joomla in a subdirectory, change to that directory instead, and then change to the cli directory.
Managing Smart Search indexing
You can manage the Smart Search indexing feature by using the finder_indexer.php application.
If you run this application with no arguments, it updates the search index incrementally. Alternatively, if you use the —purge option, it deletes and then rebuilds the entire index.
To run this application, type the following commands:
cd ~/public_html/cli php finder_indexer.php --purge
If you installed Joomla in a subdirectory, change to that directory instead, and then change to the cli directory.
For more information about this application, please visit https://docs.joomla.org/Setting_up_automatic_Smart_Search_indexing.
Writing your own CLI applications
You can also create your own Joomla CLI applications for custom tasks that you want to automate. For information about how to do this, please visit https://docs.joomla.org/How_to_create_a_stand-alone_application_using_the_Joomla!_Platform.