Created
May 2, 2026 19:50
-
-
Save fabianoflorentino/f03e75a13e2388e8200c07874019b23c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Tmux Cheat Sheet (prático) | |
| > Prefixo padrão: `Ctrl+b` | |
| > Quase todos os comandos começam com o prefixo. | |
| --- | |
| # Sessões | |
| ## Criar sessão | |
| ```bash | |
| tmux | |
| ``` | |
| ou nomeando: | |
| ```bash | |
| tmux new -s projeto | |
| ``` | |
| --- | |
| ## Listar sessões | |
| ```bash | |
| tmux ls | |
| ``` | |
| --- | |
| ## Entrar em uma sessão | |
| ```bash | |
| tmux attach -t projeto | |
| ``` | |
| ou: | |
| ```bash | |
| tmux a -t projeto | |
| ``` | |
| --- | |
| ## Sair da sessão (sem matar) | |
| Prefixo: | |
| ```text | |
| Ctrl+b d | |
| ``` | |
| (detach) | |
| --- | |
| ## Matar sessão | |
| ```bash | |
| tmux kill-session -t projeto | |
| ``` | |
| --- | |
| ## Renomear sessão | |
| Dentro da sessão: | |
| ```text | |
| Ctrl+b $ | |
| ``` | |
| --- | |
| # Janelas (tabs) | |
| ## Criar nova janela | |
| ```text | |
| Ctrl+b c | |
| ``` | |
| --- | |
| ## Próxima janela | |
| ```text | |
| Ctrl+b n | |
| ``` | |
| --- | |
| ## Janela anterior | |
| ```text | |
| Ctrl+b p | |
| ``` | |
| --- | |
| ## Ir para janela específica | |
| ```text | |
| Ctrl+b 0 | |
| Ctrl+b 1 | |
| Ctrl+b 2 | |
| ... | |
| ``` | |
| --- | |
| ## Listar janelas | |
| ```text | |
| Ctrl+b w | |
| ``` | |
| --- | |
| ## Renomear janela | |
| ```text | |
| Ctrl+b , | |
| ``` | |
| --- | |
| ## Fechar janela | |
| ```bash | |
| exit | |
| ``` | |
| ou: | |
| ```text | |
| Ctrl+d | |
| ``` | |
| --- | |
| # Panes (divisão de tela) | |
| ## Dividir verticalmente | |
| ```text | |
| Ctrl+b % | |
| ``` | |
| --- | |
| ## Dividir horizontalmente | |
| ```text | |
| Ctrl+b " | |
| ``` | |
| --- | |
| ## Navegar entre panes | |
| ```text | |
| Ctrl+b ← | |
| Ctrl+b → | |
| Ctrl+b ↑ | |
| Ctrl+b ↓ | |
| ``` | |
| --- | |
| ## Alternar último pane | |
| ```text | |
| Ctrl+b ; | |
| ``` | |
| --- | |
| ## Fechar pane | |
| ```bash | |
| exit | |
| ``` | |
| --- | |
| ## Maximizar/restaurar pane | |
| ```text | |
| Ctrl+b z | |
| ``` | |
| --- | |
| ## Converter pane em janela | |
| ```text | |
| Ctrl+b ! | |
| ``` | |
| --- | |
| # Redimensionar panes | |
| Entrar no modo resize: | |
| ```text | |
| Ctrl+b : | |
| ``` | |
| Depois: | |
| ```bash | |
| resize-pane -L 10 | |
| resize-pane -R 10 | |
| resize-pane -U 5 | |
| resize-pane -D 5 | |
| ``` | |
| --- | |
| Ou modo rápido: | |
| ```text | |
| Ctrl+b Ctrl+← | |
| Ctrl+b Ctrl+→ | |
| Ctrl+b Ctrl+↑ | |
| Ctrl+b Ctrl+↓ | |
| ``` | |
| (se configurado) | |
| --- | |
| # Layouts automáticos | |
| Alternar layouts: | |
| ```text | |
| Ctrl+b Space | |
| ``` | |
| --- | |
| Layout anterior: | |
| ```text | |
| Ctrl+b Alt+1 | |
| ``` | |
| (alguns terminais) | |
| --- | |
| # Copy mode (essencial) | |
| Entrar: | |
| ```text | |
| Ctrl+b [ | |
| ``` | |
| --- | |
| Movimentação: | |
| ```text | |
| ↑ ↓ PgUp PgDn | |
| ``` | |
| --- | |
| Buscar texto: | |
| ```text | |
| / | |
| ``` | |
| --- | |
| Copiar: | |
| ```text | |
| Space | |
| Enter | |
| ``` | |
| --- | |
| Sair: | |
| ```text | |
| q | |
| ``` | |
| --- | |
| Colar buffer: | |
| ```text | |
| Ctrl+b ] | |
| ``` | |
| --- | |
| # Modo comando | |
| Abrir command prompt: | |
| ```text | |
| Ctrl+b : | |
| ``` | |
| Exemplo: | |
| ```bash | |
| new-window -n logs | |
| split-window -h | |
| kill-pane | |
| ``` | |
| --- | |
| # Reload config | |
| Depois de editar: | |
| ```bash | |
| ~/.tmux.conf | |
| ``` | |
| recarregar: | |
| ```bash | |
| tmux source-file ~/.tmux.conf | |
| ``` | |
| ou: | |
| ```text | |
| Ctrl+b : | |
| source-file ~/.tmux.conf | |
| ``` | |
| --- | |
| # Modo mouse | |
| Ativar no config: | |
| ```bash | |
| set -g mouse on | |
| ``` | |
| Permite: | |
| * clicar em panes | |
| * redimensionar | |
| * scroll | |
| --- | |
| # Workflow útil | |
| ## Backend + logs + shell | |
| ```text | |
| janela 1: | |
| ├─ editor | |
| ├─ server | |
| └─ logs | |
| ``` | |
| --- | |
| ## SSH persistente | |
| ```bash | |
| tmux new -s server | |
| ssh prod | |
| ``` | |
| Detach: | |
| ```text | |
| Ctrl+b d | |
| ``` | |
| Voltar depois: | |
| ```bash | |
| tmux a -t server | |
| ``` | |
| --- | |
| ## Monitoramento | |
| ```text | |
| pane 1 → htop | |
| pane 2 → logs | |
| pane 3 → watch | |
| pane 4 → shell | |
| ``` | |
| --- | |
| # Comandos CLI úteis | |
| Nova sessão detached: | |
| ```bash | |
| tmux new -d -s worker | |
| ``` | |
| --- | |
| Executar comando: | |
| ```bash | |
| tmux new -d -s api "make run" | |
| ``` | |
| --- | |
| Enviar comando para sessão: | |
| ```bash | |
| tmux send-keys -t api "ls -la" Enter | |
| ``` | |
| --- | |
| Capturar pane: | |
| ```bash | |
| tmux capture-pane | |
| ``` | |
| --- | |
| Salvar output: | |
| ```bash | |
| tmux capture-pane -p > output.log | |
| ``` | |
| --- | |
| # Atalhos que valem decorar | |
| ```text | |
| Ctrl+b c nova janela | |
| Ctrl+b % split vertical | |
| Ctrl+b " split horizontal | |
| Ctrl+b d detach | |
| Ctrl+b z zoom pane | |
| Ctrl+b x matar pane | |
| Ctrl+b w listar janelas | |
| Ctrl+b , renomear janela | |
| Ctrl+b n próxima janela | |
| Ctrl+b p janela anterior | |
| Ctrl+b [ copy mode | |
| Ctrl+b ] paste | |
| Ctrl+b : command mode | |
| Ctrl+b ? ajuda | |
| ``` | |
| --- | |
| # Minha recomendação de uso | |
| Use: | |
| * 1 sessão por projeto | |
| * 1 janela por contexto | |
| * panes para processos relacionados | |
| Exemplo: | |
| ```text | |
| sessão: api | |
| janela 1: código | |
| janela 2: logs | |
| janela 3: db | |
| janela 4: testes | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment