목차

, , , , , ,

tmux

하나의 terminal에서 여러 shell과 program을 session, window, pane으로 구성하고 detach 후 다시 attach할 수 있는 terminal multiplexer.

Summary

Installation

# Debian / Ubuntu
sudo apt update
sudo apt install tmux
 
# Fedora
sudo dnf install tmux
 
# RHEL / CentOS
sudo yum install tmux
 
# macOS Homebrew
brew install tmux
 
# 설치 확인
tmux -V

Usage

tmux [GLOBAL_OPTIONS] [COMMAND [COMMAND_OPTIONS] [ARGS...]]

Options

Global Options

각 tmux command의 option은 command 뒤에 둔다. 예를 들어 session 이름을 지정하는 -snew-session의 option이다.

Commands

Session

Window and Pane

Inspect and Control

tmux kill-server는 해당 server의 모든 session과 그 안의 process를 종료한다. 먼저 tmux ls로 대상을 확인하고, 단일 session만 닫을 때는 kill-session -t NAME을 사용한다.

Examples

Create or Attach

# work session이 있으면 attach하고 없으면 생성
tmux new-session -As work
 
# background에서 session 생성
tmux new-session -d -s build
 
# session 확인 및 attach
tmux list-sessions
tmux attach-session -t build

Window and Pane

# 이름이 logs인 window 생성
tmux new-window -n logs
 
# 좌우 분할
tmux split-window -h
 
# 위아래 분할
tmux split-window -v
 
# pane 목록과 id 확인
tmux list-panes -a -F '#{session_name}:#{window_index}.#{pane_index} #{pane_id}'

Remote Work

# remote host에서 session 생성 또는 재접속
ssh server
tmux new-session -As work

Configuration

Troubleshooting

Compatibility

Help

tmux help commands

See Also

History