Remote Workflows
This lesson combines everything — kitty SSH, terminfo, remote control, and kittens — into practical, real-world workflows for managing remote servers.
These workflows are designed for daily DevOps use. Master the remote_file kitten for editing, icat for viewing images, and the tmux+kitty pairing for persistent sessions.
Workflow 1: Edit Remote Files Locally
The remote_file kitten opens a remote file in your local editor. This avoids installing editors on the server:
# Edit nginx config on the remote server
kitty +kitten remote_file user@web-server:/etc/nginx/nginx.conf
# Edits happen in your local $EDITOR (vim, code, etc.)
# When you save and close, the file is written back to the remote
┌────────────┐ SCP download ┌───────────────┐
│ Kitty │◀─────────────▶│ Remote Server │
│ (local) │ │ │
│ │ 1. Download │ /etc/nginx/ │
│ $EDITOR │ file │ nginx.conf │
│ vim/ │ 2. Open locally│ │
│ nano/code │ 3. Edit & save │ │
│ │ 4. Upload back │ │
└────────────┘ SCP upload └───────────────┘
# Read remote file to stdout (no editing)
kitty +kitten remote_file --stdout user@server:/etc/os-release
# Edit with a specific editor
EDITOR=nano kitty +kitten remote_file user@server:/etc/hosts
Workflow 2: View Images on Remote Server (icat)
Display images from a remote server on your local kitty terminal:
# SSH into server then run icat
kitty +kitten ssh user@server
icat /path/to/screenshot.png
# Or one-liner
kitty +kitten ssh user@server -- icat /var/www/site-screenshot.png
The icat kitten uses kitty's graphics protocol to render images inline. This works over SSH because kitty forwards the protocol through the terminal:
Remote Server Local Machine
┌────────────┐ SSH/TTY ┌────────────┐
│ icat │────────────▶│ Kitty │
│ image.png │ escape │ GPU │
│ │ sequences │ Render │
│ │ │ │
│ │ │ ┌─────────┐│
│ │ │ │ Inline ││
│ │ │ │ Image ││
└────────────┘ │ └─────────┘│
└────────────┘
# Example: Preview server screenshots
kitty +kitten ssh user@server "icat ~/screenshots/latest.png"
# Resize the image
kitty +kitten ssh user@server "icat --scale-up --place 80x40@0x0 image.png"
Workflow 3: SSH Config for Kitty
Optimize your ~/.ssh/config for kitty:
# Default kitty settings
Host *
# Forward correct terminal type
SetEnv TERM=xterm-kitty
# Keep connection alive (prevents timeout)
ServerAliveInterval 60
ServerAliveCountMax 3
# Forward X11 if needed
ForwardX11 no
# Enable SSH compression for faster responses
Compression yes
# Web servers group
Host web-*
User deploy
IdentityFile ~/.ssh/deploy-key
# Database servers
Host db-*
User admin
Port 2222
Workflow 4: Copy Files with Transfer Kitten
# Transfer a file to the remote
kitty +kitten transfer user@server:/tmp/local-file.txt /home/user/
# Download from remote
kitty +kitten transfer --direction download user@server:/var/log/syslog /tmp/
# Transfer directory recursively
kitty +kitten transfer --recursive user@server:/srv/myapp/logs/ ./backup-logs/
The transfer kitten provides a progress bar and automatic resume on failure — unlike raw scp or rsync for small transfers:
┌───────────────────────────────────────┐
│ Transfer: /var/log/syslog │
│ ████████████████░░░░░░░░░ 68% │
│ Speed: 2.5 MB/s ETA: 4s │
└───────────────────────────────────────┘
Workflow 5: Session Persistence Over SSH
Kitty is a terminal emulator, not a multiplexer. For persistent remote sessions, combine with tmux:
# Step 1: Connect with kitty SSH
kitty +kitten ssh user@server
# Step 2: Start or attach to a tmux session
tmux new -s remote-work
# Or do it in one shot
kitty +kitten ssh -t user@server "tmux new -s deploy -d && tmux attach -t deploy"
# Step 3: Work inside tmux — if SSH drops, tmux keeps running
# Step 4: Reconnect later
kitty +kitten ssh user@server
tmux attach -t deploy
Kitty gives you GPU rendering, kittens, and local window management. Tmux gives you session persistence, pane multiplexing, and detachment. Together they are unbeatable.
Workflow 6: Monitoring Dashboard via SSH
#!/bin/bash
# Connects to a remote server and sets up a monitoring dashboard
SERVER="$1"
if [ -z "$SERVER" ]; then
echo "Usage: $0 user@server"
exit 1
fi
# Create a new kitty tab for the remote session
kitty @ launch --type=tab --title "Remote: $SERVER"
# Connect and start tmux with monitoring layout
kitty +kitten ssh -t "$SERVER" "
tmux new -d -s monitor 2>/dev/null
tmux send-keys -t monitor 'htop' Enter
tmux split-window -h -t monitor
tmux send-keys -t monitor 'watch df -h' Enter
tmux split-window -v -t monitor.0
tmux send-keys -t monitor.1 'journalctl -f' Enter
tmux select-layout -t monitor tiled
tmux attach -t monitor
"
Make it executable and run:
chmod +x ~/bin/remote-dashboard.sh
~/bin/remote-dashboard.sh user@prod-server
Common Pitfalls
| Pitfall | Symptom | Fix |
|---|---|---|
remote_file writes back on close | Modified file corrupt on remote | Ensure the file is saved and closed properly in the editor |
icat shows garbled characters over SSH | Terminfo missing or wrong | Run kitty +kitten ssh --install-terminal |
| Transfer kitten slow on large files | Better to use rsync | Use transfer for <100MB files; rsync for larger |
| SSH timeout idle session | "Connection closed" | Add ServerAliveInterval 60 to ~/.ssh/config |
| Kitty + tmux keybinding conflicts | Keys go to wrong layer | Know which layer captures each key (kitty → tmux → app) |
Hands-On Practice
# 1) Create ~/.ssh/config kitty optimization
cat >> ~/.ssh/config << 'EOF'
# Kitty-optimized defaults
Host *
SetEnv TERM=xterm-kitty
ServerAliveInterval 60
Compression yes
EOF
# 2) Test remote_file (to localhost for practice)
echo "Hello from remote" | ssh localhost "cat > /tmp/kitty-remote-test.txt"
kitty +kitten remote_file --stdout localhost:/tmp/kitty-remote-test.txt
ssh localhost "rm /tmp/kitty-remote-test.txt"
# 3) Test transfer kitten (to localhost)
echo "transfer test data" > /tmp/kitty-transfer-test.txt
kitty +kitten transfer /tmp/kitty-transfer-test.txt localhost:/tmp/
ssh localhost "cat /tmp/kitty-transfer-test.txt"
rm /tmp/kitty-transfer-test.txt
ssh localhost "rm /tmp/kitty-transfer-test.txt"
# 4) Create a local tmux + kitty practice
# (Open a new kitty tab, start tmux, create a split)
kitty @ launch --type=tab --title "tmux-practice"
# Inside that tab:
# tmux new -s practice
# tmux split-window -h
# tmux split-window -v