ssh-cache command manages the SSH terminfo cache used for automatic remote host setup when SSH integration is enabled.
Usage
Description
When SSH integration is enabled withshell-integration-features = ssh-terminfo, Ghostty automatically installs its terminfo database on remote hosts when you SSH into them. This command manages the cache of successful installations to avoid redundant uploads.
The cache stores hostnames (or user@hostname combinations) along with timestamps of when terminfo was successfully installed. Entries older than a configurable expiration period can be automatically removed, though by default entries never expire.
Options
Clear the entire SSH cache, removing all stored hostnames. After clearing, Ghostty will re-upload terminfo to all hosts on next connection.
Manually add a hostname to the cache. Accepts formats:
hostname- Just the hostnameuser@hostname- User and hostname combination
Remove a specific hostname from the cache. Next SSH connection to this host will trigger terminfo upload. Accepts same formats as
--add.Check if a specific host is in the cache. Returns exit code 0 if cached, 1 if not. Useful for scripting.
Set a custom expiration period in days for cache entries. Entries older than this will be considered invalid and removed during cache operations.By default, entries never expire.
Display help information for this command.
Examples
List All Cached Hosts
Check If Host Is Cached
Add Host to Cache
Remove Host from Cache
Clear Entire Cache
Set Expiration Period
Cache Behavior
Automatic Cache Updates
When SSH integration is enabled:- Ghostty detects SSH connections
- Checks if the target host is in the cache
- If not cached, uploads terminfo to the remote host
- On successful upload, adds host to cache
- Subsequent connections skip the upload
Cache Storage Location
The cache is stored in:- Linux:
$XDG_CACHE_HOME/ghostty/ssh-cacheor~/.cache/ghostty/ssh-cache - macOS:
~/Library/Caches/com.mitchellh.ghostty/ssh-cache
Entry Format
Cache entries can be:- Just hostname:
example.com - User + hostname:
user@example.com - IP address:
192.168.1.100 - User + IP:
user@192.168.1.100
Use Cases
Pre-populate Cache
Before bulk SSH operations:Script
Force Terminfo Re-upload
If terminfo is corrupted on a remote host:Check Cache in Scripts
Script
Periodic Cache Maintenance
Cron Job
Troubleshooting
Terminfo Not Loading on Remote Host
-
Check if host is cached:
-
Remove from cache to force re-upload:
-
Connect again to trigger upload:
Invalid Hostname Error
Error
hostname.comuser@hostname.com
Cache Is Locked Error
Error
SSH Integration Configuration
Enable SSH terminfo integration in your config:config
Notes
The cache only tracks successful terminfo installations. If upload fails, the host is not added to the cache and will be retried on the next connection.
Entries in the cache don’t expire by default. Use
--expire-days to set an expiration policy if desired.The cache is per-user on your local machine. Each user maintains their own separate SSH terminfo cache.