กลับไปหน้าสูตร
#tmux#terminal#command#cheatsheet

tmux Command Cheatsheet

รวมคำสั่ง tmux แบบใช้งานจริง: session, window, pane, copy mode, key bindings และ workflow สำหรับ dev

11 มีนาคม 2569อ่านประมาณ 2 นาที

Core Concepts

Conceptความหมาย
Sessionworkspace หลัก
Windowเหมือนแท็บ
Panesplit ใน window
Prefixปุ่มนำก่อนสั่งงาน (Ctrl+b ค่า default)

Session Commands

Commandใช้ทำอะไร
tmuxสร้าง session ใหม่
tmux new -s devสร้าง session ชื่อ dev
tmux lsดู sessions
tmux a -t devattach session dev
tmux detachdetach ออกจาก session
tmux kill-session -t devลบ session
tmux rename-session -t dev workเปลี่ยนชื่อ session

Window Commands

Commandใช้ทำอะไร
Prefix + cสร้าง window
Prefix + n / pถัดไป / ก่อนหน้า
Prefix + 0..9ไป window ตามเลข
Prefix + ,rename window
Prefix + &ปิด window
Prefix + wlist windows

Pane Commands

Commandใช้ทำอะไร
Prefix + %split แนวตั้ง
Prefix + "split แนวนอน
Prefix + oสลับ pane
Prefix + ;สลับ pane ล่าสุด
Prefix + xปิด pane
Prefix + zzoom pane
Prefix + { / }สลับตำแหน่ง pane

Resize Panes

Commandใช้ทำอะไร
Prefix + Ctrl + Arrowresize pane
Prefix + Alt + 1..5resize ตาม binding ที่ตั้งเอง (ถ้ามี)

Copy Mode

Commandใช้ทำอะไร
Prefix + [เข้า copy mode
qออก copy mode
Spaceเริ่ม select
Entercopy selection
Prefix + ]paste

Useful tmux.conf Snippet

set -g mouse on
set -g history-limit 100000
set -g base-index 1
setw -g pane-base-index 1
bind r source-file ~/.tmux.conf \; display "reloaded"

Daily Workflow

StepAction
สร้างงานtmux new -s project-a
แยก panecode / server / logs
detachPrefix + d
กลับมาทำต่อtmux a -t project-a