← All cheatsheets

Remote

ssh + tmux — remote work without losing your session

Work on remote servers without losing progress: ssh basics, a ~/.ssh/config template, and the tmux keys that keep sessions alive.

ssh basics

ssh user@host — connect

ssh -i ~/.ssh/key user@host — with specific key

ssh-keygen -t ed25519 — generate new key

ssh-copy-id user@host — push key to server

scp file user@host:/path — copy file to remote

rsync -av src/ user@host:dst/ — sync dirs

ssh config (~/.ssh/config)

Host prod
  HostName 1.2.3.4
  User deploy
  IdentityFile ~/.ssh/deploy_key

Then: ssh prod

tmux essentials (prefix is Ctrl-b)

tmux — start session

tmux ls — list sessions

tmux attach -t name — reattach

Ctrl-b c — new window

Ctrl-b n — next window

Ctrl-b " / Ctrl-b % — split horizontal / vertical

Ctrl-b d — detach (leaves session running)