Grav — CLI for the Grav Flat-File CMS
Practical guide to the Grav CLI tools: bin/grav for cache, backup and scheduler, and bin/gpm for installing and updating plugins and themes.
Grav is a modern PHP-based flat-file CMS: it needs no database and stores your content as plain Markdown and YAML files right in the filesystem. You manage it through two command-line tools – bin/grav for core tasks such as clearing the cache, backups and the scheduler, and bin/gpm, the Grav Package Manager, which installs and keeps plugins and themes up to date. This guide walks you through the everyday commands of both tools, from cache maintenance to a core upgrade.
bin/grav — General
bin/grav list — List all available Grav CLI commands.
bin/grav listbin/grav help <command> — Show help for a specific command.
bin/grav help clear-cachebin/grav new-project <path> — Create a new Grav project in a directory.
bin/grav new-project ~/sites/my-grav-sitebin/grav sandbox — Create a symlinked sandbox copy of Grav (for development).
bin/grav sandbox -s ~/grav-core ~/sites/my-sandboxbin/grav — Cache & Clean
bin/grav clear-cache — Clear the Grav cache.
bin/grav clear-cachebin/grav clear-cache --all — Clear all cache types (standard + images + assets).
bin/grav clear-cache --allbin/grav clear-cache --assets-only — Clear only compiled asset cache (CSS/JS pipeline).
bin/grav clear-cache --assets-onlybin/grav clear-cache --images-only — Clear only image cache (generated thumbnails).
bin/grav clear-cache --images-onlybin/grav clear-cache --tmp-only — Clear only temporary files.
bin/grav clear-cache --tmp-onlybin/grav clean — Remove unnecessary files (vendor cruft, tests, docs).
bin/grav cleanbin/grav — Backup & Security
bin/grav backup — Create a full backup of the Grav site.
bin/grav backupbin/grav backup --destination <path> — Create a backup to a specific directory.
bin/grav backup --destination ~/backupsbin/grav security — Run a security scan on the Grav installation.
bin/grav securitybin/grav logviewer — View Grav log entries from the command line.
bin/grav logviewerbin/grav — Scheduler & Composer
bin/grav scheduler -i — Install the Grav scheduler cron job.
bin/grav scheduler -ibin/grav scheduler -r — Remove the Grav scheduler cron job.
bin/grav scheduler -rbin/grav scheduler — Run pending scheduled tasks manually.
bin/grav schedulerbin/grav composer — Run Composer within the Grav context.
bin/grav composer updatebin/grav yamllinter — Check all YAML files for syntax errors.
bin/grav yamllinterbin/gpm — Package Info
bin/gpm index — List all available plugins and themes from the repository.
bin/gpm indexbin/gpm index --plugins — List only available plugins.
bin/gpm index --pluginsbin/gpm index --themes — List only available themes.
bin/gpm index --themesbin/gpm info <package> — Show detailed info about a plugin or theme.
bin/gpm info adminbin/gpm version — Show Grav and plugin versions.
bin/gpm versionbin/gpm — Install & Uninstall
bin/gpm install <package> — Install a plugin or theme.
bin/gpm install adminbin/gpm install <pkg1> <pkg2> — Install multiple packages at once.
bin/gpm install admin login sitemapbin/gpm install --all-yes <package> — Install without confirmation prompts.
bin/gpm install --all-yes feedbin/gpm uninstall <package> — Uninstall a plugin or theme.
bin/gpm uninstall simplesearchbin/gpm — Update
bin/gpm update — Check for and install plugin/theme updates.
bin/gpm updatebin/gpm update <package> — Update a specific plugin or theme.
bin/gpm update adminbin/gpm update --plugins — Update only plugins.
bin/gpm update --pluginsbin/gpm update --themes — Update only themes.
bin/gpm update --themesbin/gpm self-upgrade — Upgrade the Grav core to the latest version.
bin/gpm self-upgradebin/gpm self-upgrade -f — Force a Grav core upgrade (re-download even if up to date).
bin/gpm self-upgrade -f Conclusion
With bin/grav and bin/gpm you manage an entire Grav installation straight from the command line – with no database backend, because Grav keeps all content as files. Before every plugin, theme or core update, grab a full snapshot with bin/grav backup, so a failed bin/gpm update or self-upgrade can always be rolled back. Mind your file permissions, too: the web-server user needs write access to cache/, logs/, backup/ and user/, but shouldn't own the whole directory. That keeps your site both current and secure.
Further Reading
- Grav documentation – official manual covering the CLI, plugins and themes
- getgrav.org – project site with downloads and the plugin/theme directory
- GPM – Grav Package Manager – reference for all
bin/gpmcommands