15+ Helpful TYPO3 Console (CLI) Commands You Should Know

15+ Helpful TYPO3 Console (CLI) Commands You Should Know

FYI. This blog is translated by machine. Please ignore any spelling and grammar errors; sorry for such inconvenience. We appreciate your understanding and support.

Hello TYPO3 enthusiasts! If you’re looking for a way to speed up your TYPO3 workflows, automate repetitive tasks, and gain more control over your website’s maintenance, then you’re in the right place. In this blog post, we’ll explore essential TYPO3 console commands (including both TYPO3 core CLI and the popular typo3_console extension). We’ll also walk through the basics of how to access and use the TYPO3 CLI.

If you’ve been working with TYPO3 for a while, you might have used the web-based backend for many administrative tasks—like clearing caches, updating extensions, or running database upgrades. But as your projects grow, handling these tasks manually can become time-consuming.

That’s where the TYPO3 Command-Line Interface (CLI) comes in handy. The CLI allows you to run commands right from your terminal or command prompt. This approach is:

  • Faster: No need to navigate through multiple backend modules like TYPO3 Scheduler
  • Scriptable: Integrate into CI/CD pipelines for automated deployments.
  • Powerful: Some features are only accessible via CLI (like advanced cleanup tasks).

If you’re working locally or via SSH on a server, simply open your terminal and navigate to the TYPO3 project’s root directory. Then, you can run commands in one of these ways:

1. Composer-Based Installation (Most Common)
 

vendor/bin/typo3 <command>

2. Older/Alternative Approach

typo3cms <command>
or
typo3 <command>

The exact executable name can vary slightly depending on your TYPO3 version and file setup. For recent TYPO3 installs, vendor/bin/typo3 is the standard approach.

Here are 15 essential TYPO3 CLI commands to streamline your day-to-day tasks. Each command generally follows the same syntax pattern:

vendor/bin/typo3 <command> [arguments] [options]
  1. cache:flush
    • Purpose: Flush all TYPO3 caches.
    • Usage: vendor/bin/typo3 cache:flush
    • Tip: Use it whenever you suspect caching issues or after installing new extensions.
  2. cache:warmup
    • Purpose: Pre-load caches to improve performance.
    • Usage: vendor/bin/typo3 cache:warmup
    • Tip: Run it post-deployment for a smoother user experience.
  3. extension:setup
    • Purpose: Initialize or update TYPO3 extensions.
    • Usage: vendor/bin/typo3 extension:setup
    • Tip: Perfect after adjusting your composer.json dependencies.
  4. scheduler:run
    • Purpose: Execute TYPO3 scheduler tasks on demand.
    • Usage: vendor/bin/typo3 scheduler:run
    • Tip: A lifesaver if your cron job fails or if you want to manually trigger tasks.
  5. upgrade:run
    • Purpose: Execute upgrade wizards (especially useful during version upgrades).
    • Usage: vendor/bin/typo3 upgrade:run
    • Tip: Always back up your DB before running upgrade wizards!
  6. upgrade:mark:undone
    • Purpose: Revert a specific upgrade wizard.
    • Usage: vendor/bin/typo3 upgrade:mark:undone <wizardIdentifier>
    • Tip: Helpful if you need to re-run or if something went wrong.
  7. setup
    • Purpose: Re-run setup tasks (similar to basic install tool steps).
    • Usage: vendor/bin/typo3 setup
    • Tip: Great for new projects or after environment configuration changes.
  8. backend:lock
    • Purpose: Lock the TYPO3 backend for maintenance.
    • Usage: vendor/bin/typo3 backend:lock --reason="Maintenance mode"
    • Tip: Keep editors out while performing major updates or database changes.
  9. backend:user:create
    • Purpose: Create a backend user from the CLI.
    • Usage: vendor/bin/typo3 backend:user:create <username> <password> [--admin]
    • Tip: Instantly create a user if you can’t access the backend or forget your credentials.
  10. cleanup:deletedrecords
    • Purpose: Permanently delete soft-deleted records.
    • Usage: vendor/bin/typo3 cleanup:deletedrecords
    • Tip: Routine database housekeeping keeps things lean and efficient.
  11. cleanup:missingrelations
    • Purpose: Identify and fix missing references in the database.
    • Usage: vendor/bin/typo3 cleanup:missingrelations --dry-run
    • Tip: Always do a --dry-run first to see changes that will be made.
  12. cleanup:orphanrecords
    • Purpose: Remove orphaned records (data with no valid references).
    • Usage: vendor/bin/typo3 cleanup:orphanrecords
    • Tip: Great after big content migrations or deletions.
  13. cleanup:localprocessedfiles
    • Purpose: Remove unused processed files from typo3temp.
    • Usage: vendor/bin/typo3 cleanup:localprocessedfiles
    • Tip: Free up disk space and improve performance.
  14. language:update
    • Purpose: Update TYPO3 language packs from the translation server.
    • Usage: vendor/bin/typo3 language:update <languageKey>
    • Tip: Keep your multilingual site current with the latest translations.
  15. referenceindex:update
    • Purpose: Rebuild TYPO3’s reference index.
    • Usage: vendor/bin/typo3 referenceindex:update
    • Tip: A quick fix for issues related to record linking or internal references.

In addition to the core commands, the typo3_console extension by Helmut Hummel provides extra commands that can supercharge your workflow. Many development teams rely on these for automated deployments, DevOps tasks, and advanced maintenance. Here are a few highlights:

  1. database:updateschema
    • Purpose: Apply DB schema changes automatically.
    • Usage: vendor/bin/typo3 database:updateschema
    • Why It’s Cool: No more manual DB compares—ideal for CI pipelines.
  2. install:fixfolderstructure
    • Purpose: Ensure proper folder structure and permissions.
    • Usage: vendor/bin/typo3 install:fixfolderstructure
    • Why It’s Cool: A huge time-saver when spinning up new servers.
  3. backend:lockforeditors
    • Purpose: Lock out editors while leaving admins free.
    • Usage: vendor/bin/typo3 backend:lockforeditors --reason="Content freeze"
    • Why It’s Cool: Granular control during content freeze or partial maintenance.
  4. cache:flushtags
    • Purpose: Flush caches by specific tags.
    • Usage: vendor/bin/typo3 cache:flushtags --tags="pages,tt_content"
    • Why It’s Cool: Targeted cache clearing for partial rollouts or troubleshooting.
  5. configuration:set
    • Purpose: Set TYPO3 configuration via CLI (system config, etc.).
    • Usage: vendor/bin/typo3 configuration:set SYS/displayErrors 1
    • Why It’s Cool: Update system settings without fiddling with configuration files.
  6. frontend:asseturl
    • Purpose: Generate public URLs for frontend assets.
    • Usage: vendor/bin/typo3 frontend:asseturl --file="EXT:myext/Resources/Public/Css/styles.css"
    • Why It’s Cool: Handy for debugging or advanced deployment setups using CDN.

Creating a custom TYPO3 CLI command is easier than you might think. Here’s a quick step-by-step:

Step 1. Create a Command Class

In your extension (e.g., EXT:my_extension), add a PHP class extending the base Symfony command:

<?php
declare(strict_types=1);

namespace Vendor\MyExtension\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Console\Command\BaseCommand;

class MyCustomCommand extends BaseCommand
{
    protected function configure()
    {
        $this->setDescription('This is my custom CLI command.')
             ->setHelp('More details about what the command does...');
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output->writeln('Hello from MyCustomCommand!');
        // Add your custom logic here...

        return 0; // 0 indicates a successful run
    }
}

Step 2. Register the Command

For TYPO3 v10 and above, you can register your command via Services.yaml in your extension’s Configuration folder:

services:
  Vendor\MyExtension\Command\MyCustomCommand:
    tags:
      - name: 'console.command'

Step 3. Run and Test

Switch to your terminal and try:

 vendor/bin/typo3 myextension:mycustomcommand

If everything is set up correctly, you should see the output message, “Hello from MyCustomCommand!”

Step 4. Refine & Automate

  • Add arguments or options to your command (e.g., ->addArgument('path')).
  • Integrate into CRON jobs, deployment scripts, or run it manually whenever needed.

Bonus: If you’re on an older version of TYPO3, you might still use Extbase command controllers, but the concept is similar—define commands, register them, and execute.

  • Use --dry-run: Always test cleanup or destructive commands in dry-run mode if available.
  • Automate with CRON: CRON jobs let you schedule commands (like scheduler:run) on a regular basis.
  • Log Everything: Keep logs of your CLI commands and outputs for debugging.
  • Lock the Backend: Use backend:lock or backend:lockforeditors to prevent unexpected changes during maintenance.
  • Check Version Compatibility: Some commands differ between TYPO3 versions. Always read the docs for your specific setup.

In a nutshell, mastering TYPO3’s CLI can supercharge your productivity. From flushing caches to creating backend users and running advanced cleanup tasks, the command line offers speed, consistency, and effortless automation. Pair it with typo3_console for even more powerful DevOps-friendly features.

Ready to dive deeper? Experiment with a few commands on your local environment, incorporate them into your deployment pipeline, or craft a custom command for that repetitive task you’ve always dreaded. You’ll never look at manual backend clicks the same way again!

Got any favorite CLI commands or pro tips? Share your thoughts below. If you found this guide helpful, feel free to share it with your fellow TYPO3 enthusiasts!

Happy Coding and CLI-ing!

Your One-Stop Solutions for Custom TYPO3 Development

  • A Decade of TYPO3 Industry Experience
  • 350+ Successful TYPO3 Projects
  • 87% Repeat TYPO3 Customers
TYPO3 Service
service

Post a Comment

×