Ghost CLI (ghost-cli) is the official command-line tool for installing, configuring, and managing self-hosted Ghost Blog instances. This guide and cheat sheet covers every major command with practical examples, keyboard shortcuts, and a breakdown of Ghost's post types.
Installation & Updates
Install or update Ghost CLI globally via npm. Using @latest handles both cases with one command.
# Production server (non-root user)
sudo npm install -g ghost-cli@latest
# Local machine (no sudo needed)
npm install -g ghost-cli@latest
# Verify installation
ghost --version
Install & Setup Commands
ghost install
The all-in-one production installer. Runs ghost doctor → downloads Ghost → runs ghost setup → starts Ghost. Configures MySQL, NGINX, SSL (Let's Encrypt), and systemd automatically.
# Full production install (prompts for MySQL, URL, SSL, etc.)
ghost install
# Install a specific version
ghost install 5.80.0
# Local development install (SQLite3 + local process manager)
ghost install local
# Install specific version locally
ghost install 5.80.0 --local
# Install without running setup (configure manually later)
ghost install --no-setup
# Install without starting Ghost afterward
ghost install --no-start
# Non-interactive install (pass all args as flags)
ghost install --url https://mysite.com --db mysql --dbhost localhost \
--dbuser ghost --dbpass secret --dbname ghost_prod --no-prompt
ghost setup
Runs the configuration stages individually. Called automatically by ghost install, but useful for re-running specific stages.
# Run full setup
ghost setup
# Run only the SSL stage
ghost setup ssl
# Run only NGINX config
ghost setup nginx
# Run only the MySQL user creation
ghost setup mysql
# Run only systemd service setup
ghost setup systemd
Lifecycle Commands
ghost start # Start the Ghost instance
ghost stop # Stop the Ghost instance
ghost restart # Restart (required after config changes)
ghost run # Start in foreground — useful for debugging
ghost ls # List all Ghost instances on the server
Example — restart after a config change:
ghost config url https://newdomain.com
ghost restart
Example — check what's running across multiple sites:
ghost ls
# Name Location Version Status URL
# my-blog /var/www/my-blog 5.80.0 running https://myblog.com
# staging /var/www/staging 5.79.0 stopped https://staging.myblog.com
Update & Rollback Commands
# Update to latest
ghost update
# Update to a specific version
ghost update 6.39.0
ghost update 5 # last major version
# Roll back to the previous version
ghost update --rollback
# Check for environment issues before updating
ghost doctor
Tip: Ghost keeps previous versions in /versions/, so rollback is instant — no re-download needed.
Ghost Forced updated and Downgrade
In case of problematic start of the ghost instance you can downgrade Ghost by
ghost update v6.38.0 --force
Configuration Commands
ghost config reads and writes your .config.[env].json file. Always run ghost restart for changes to take effect.
# Open interactive config wizard
ghost config
# Read a single value
ghost config url
# → https://mysite.com
# Set a value
ghost config url https://newsite.com
# Set mail transport
ghost config mail SMTP
ghost config mailservice Mailgun
ghost config mailuser [email protected]
ghost config mailpass supersecretpassword
Key config flags
| Flag | Example | Description |
|---|---|---|
--url |
--url https://mysite.com |
Site URL including protocol |
--admin-url |
--admin-url https://admin.mysite.com |
Separate admin URL |
--port |
--port 2368 |
Port Ghost listens on |
--db |
--db mysql |
Database type (sqlite3 or mysql) |
--dbhost |
--dbhost localhost |
MySQL host |
--dbuser |
--dbuser ghost |
MySQL username |
--dbpass |
--dbpass **** |
MySQL password |
--dbname |
--dbname ghost_prod |
MySQL database name |
--mail |
--mail SMTP |
Mail transport |
--mailservice |
--mailservice Mailgun |
Mail provider |
--process |
--process systemd |
Process manager (local or systemd) |
Diagnostics & Logs
# Check environment for common issues
ghost doctor
# View live logs (error + access)
ghost log
# Verbose log output for debugging
ghost log --verbose
Example — diagnose a failed install:
ghost doctor
# ✔ System checks passed
# ✖ MySQL user 'ghost' does not exist
# ✖ Port 80 is in use by another process
Global Flags
These can be combined with any command.
| Flag | Short | Description |
|---|---|---|
--help |
-h |
Show help for any command |
--version |
-v |
Print CLI and Ghost version |
--verbose |
-V |
Enable verbose/debug output |
--dir path/to/dir |
Run command in a different directory | |
--no-prompt |
Skip all interactive prompts | |
--no-color |
Disable colored terminal output | |
--development |
-D |
Run in development mode |
Examples:
# Get help for a specific command
ghost update --help
# Manage a Ghost install in a non-current directory
ghost --dir /var/www/my-other-blog restart
# Run install with no interactive prompts (CI/CD pipelines)
ghost install --no-prompt --url https://mysite.com --db sqlite3
Directory Structure
After installing Ghost, your directory will look like this. Never manually modify anything outside /content.
/var/www/ghost/
├── .config.production.json # Main config file — edit via ghost config
├── .config.development.json # Dev config (if installed locally)
├── .ghost-cli # CLI metadata — do not touch
├── /content/ # Yours — preserved across all updates
│ ├── /themes/ # Custom themes go here
│ ├── /images/ # Uploaded media
│ ├── /data/ # SQLite DB (ghost.db) for local installs
│ ├── /files/ # File uploads (PDFs, downloads)
│ └── /logs/ # Ghost application logs
├── /current/ # Symlink → active version (e.g. /versions/5.80.0)
├── /versions/ # All installed versions (enables rollback)
└── /system/ # ⚠ System-managed
├── /nginx/ # NGINX site config
├── /systemd/ # systemd service file
└── /ssl/ # Let's Encrypt certificates
What to back up:
/content/images/
/content/themes/
/content/data/*.db # SQLite only
.config.production.json
Edit Ghost production.json file
You will need to connect to your server and then enter the root password:
sudo nano config.production.json
URLs Reference
| URL | Purpose |
|---|---|
http://localhost:2368 |
Frontend (local dev) |
http://localhost:2368/ghost |
Admin panel (local dev) |
https://yourdomain.com/ghost |
Admin panel (production) |
https://yourdomain.com/ghost/#/settings |
Site settings |
https://yourdomain.com/ghost/#/members |
Members list |
https://yourdomain.com/ghost/debug |
Debug + export/import page |
Ghost Post Types
Ghost supports several distinct content types, each serving a different purpose in your publication.
Posts
The default content type. Appear in your main feed, can be tagged, have authors, and support access tiers.
- Public post — visible to everyone, no login required
- Members-only post — requires a free account (email sign-up)
- Paid post — requires an active paid membership
- Scheduled post — written now, published at a future date/time
- Draft — unpublished work-in-progress
- Featured post — flagged for prominence; themes typically display these differently (e.g., pinned to top, larger cards)
Pages
Static, standalone content. Do not appear in the main feed or RSS. Used for:
- About, Contact, Privacy Policy pages
- Custom landing pages
- Membership sign-up or thank-you pages
Pages can be linked in navigation but are excluded from all post loops by default.
Email newsletters
Ghost can send posts as email newsletters to your subscriber list. Each post has an email-only toggle — when enabled, the content is delivered to subscribers' inboxes but not published to the web.
- Email + web — published publicly and emailed to subscribers (default)
- Email-only — sent to subscribers, invisible on the website
Tags (internal vs public)
Not a post type per se, but tags control how content is grouped and displayed:
- Public tags — visible to readers, used for content categories (e.g.,
#tutorials,#news) - Internal tags — prefixed with
#, hidden from readers, used for theme logic (e.g.,#featured,#newsletter)
Keyboard Shortcuts (Admin Panel)
These work inside the Ghost admin at /ghost.
| Shortcut | Action |
|---|---|
N |
New post |
Ctrl/Cmd + S |
Save / update post |
Ctrl/Cmd + K |
Command palette (search + actions) |
Ctrl/Cmd + Alt + P |
Toggle post preview |
Ctrl/Cmd + Alt + R |
Open post settings panel |
Ctrl/Cmd + Z |
Undo |
Ctrl/Cmd + Shift + Z |
Redo |
? |
Show all editor shortcuts |
Editor card shortcuts
In the editor, type / to open the card menu, or use these shortcuts:
| Shortcut | Card inserted |
|---|---|
/image |
Image card |
/gallery |
Image gallery |
/video |
Video embed |
/audio |
Audio player |
/file |
File download |
/embed |
URL embed (oEmbed) |
/html |
Raw HTML card |
/markdown |
Markdown card |
/code |
Code block |
/callout |
Callout / highlight box |
/toggle |
Collapsible toggle section |
/button |
CTA button |
/products |
Product card |
/header |
Full-width header card |
/divider |
Horizontal rule |
--- |
Horizontal rule (shorthand) |
``` |
Code block (shorthand) |
> + Space |
Blockquote |
# + Space |
Heading 1 |
## + Space |
Heading 2 |
### + Space |
Heading 3 |
- or * |
Bullet list |
1. |
Numbered list |
Documentation Links
| Resource | URL |
|---|---|
| Ghost CLI reference | https://ghost.org/docs/ghost-cli/ |
| Ubuntu install guide | https://ghost.org/docs/install/ubuntu/ |
| Local install guide | https://ghost.org/docs/install/local/ |
| Configuration options | https://ghost.org/docs/config/ |
| Update guide | https://ghost.org/docs/update/ |
| Theme development | https://ghost.org/docs/themes/ |
| Content API | https://ghost.org/docs/content-api/ |
| Admin API | https://ghost.org/docs/admin-api/ |
| Community forum | https://forum.ghost.org/ |
| gctools (content utilities) | https://github.com/TryGhost/gctools |
| ghost versions on Github | https://github.com/TryGhost/Ghost/tags |
| Update To The Latest Version | https://docs.ghost.org/update-major-version |
| config.development.json | ghost/core/core/shared/config/env/config.development.json |
Bonus: Debugging a Ghost Instance That Won't Start
Start with these commands in order — each one narrows down the cause.
1. Check what Ghost thinks is wrong
ghost doctor
This is always the first stop. It checks for the most common issues: wrong Node version, port conflicts, bad permissions, missing MySQL user.
2. Try starting in the foreground
ghost run
Unlike ghost start, this keeps Ghost attached to your terminal and streams output directly. Error messages that would otherwise be swallowed show up here.
3. Read the logs
ghost log
For more detail:
ghost log --verbose
Logs are also available directly at ./content/logs/ — useful if Ghost won't start at all and the CLI can't reach the process.
4. Check Node version compatibility
node -v
ghost --version
Ghost is strict about Node versions. Cross-reference the version printed against the supported Node versions in the docs. A mismatch here is one of the most common causes of a silent failure.
5. Check ports and processes
sudo lsof -i :2368 # See what's using Ghost's default port
sudo lsof -i :80 # Check NGINX port
sudo systemctl status ghost_<your-site-name> # systemd service status
6. Inspect NGINX and systemd
sudo nginx -t # Test NGINX config for syntax errors
sudo journalctl -u ghost_<your-site-name> -n 50 # Last 50 systemd log lines
Quick order of operations::
ghost doctor→ghost run→ghost log→- check Node version →
- check ports →
- check systemd/NGINX →
- try update / downgrade of Ghost →
- server restart.