C.W.K.
Stream
Lesson 06 of 10 · published

tmux 핵심

~13 min · tmux, session, persistence

Level 0창 구경꾼
0 XP0/95 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

터미널 multiplexer

tmux 가 한 터미널 안에 여러 창과 panel 을 유지, 그리고 결정적으로 — 연결 끊겨도 살아 있어. 서버에 ssh, tmux 세션 시작, 긴 잡 실행, 노트북 닫음, 내일 돌아와 reattach, 같은 화면.

멘탈 모델

  • 서버 — 사용자당 tmux 데몬 1.
  • 세션 — 이름 있는 작업공간. 클라이언트 끊겨도 생존.
  • 윈도우 — 탭과 비슷. 세션당 다수.
  • Pane — 윈도우 안의 분할.

Prefix 키

기본 prefix 는 Ctrl+B. 모든 tmux command 가 prefix + 키. GNU Screen 머슬메모리로 Ctrl+A 로 옮기는 사람 많음 — ~/.tmux.confset -g prefix C-a; unbind C-b.

일상 command

  • tmux new -s work — work 세션 생성.
  • Ctrl+B d — detach. 세션 계속 돔.
  • tmux ls — 세션 나열.
  • tmux attach -t work — reattach.
  • Ctrl+B c — 새 윈도우.
  • Ctrl+B n / p — 다음 / 이전.
  • Ctrl+B 0..9 — N 번 윈도우.
  • Ctrl+B % — 수직 분할.
  • Ctrl+B " — 수평 분할.
  • Ctrl+B 화살표 — pane 이동.
  • Ctrl+B z — pane zoom (toggle).
  • Ctrl+B [ — copy mode (vi 키로 스크롤 / 검색).

영속 dev 환경

tmuxinator 또는 smug 이 이름 있는 layout 저장 / 복원. tmux-resurrect 는 재부팅 넘어 영속. 많은 엔지니어가 박스에 ssh, 장기 tmux 세션에 attach, 현대적 의미의 '터미널 열기' 를 하지 않음.

Code

유용한 tmux config 스니펫·tmux
# ~/.tmux.conf
set -g prefix C-a
unbind C-b
bind C-a send-prefix
set -g mouse on
set -g history-limit 50000
setw -g mode-keys vi
첫 tmux 흐름·bash
tmux new -s pippa
# inside tmux:
#   Ctrl+B c  → new window
#   Ctrl+B %  → split vertical
#   Ctrl+B "  → split horizontal
#   Ctrl+B d  → detach
tmux ls
tmux attach -t pippa

External links

Exercise

brew install tmux. tmux new -s test. 안에서: Ctrl+B c 새 창, Ctrl+B % 분할, Ctrl+B d detach. 밖에서: tmux ls, tmux attach -t test. .tmux.conf 스니펫 추가.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.