tmux cheatsheet
tmux ์ธ๊บผ์ผ!
Reference: tmux shotcuts & cheatsheet
What is tmux?
tmux
Terminal Multiplexer
ํ๋์ terminal์ ๋ถํ ํ์ฌ ์ฌ๋ฌ program์ ์คํํ๊ณ , ์คํํ program์ background mode๋ก ์ ํ ๋ฐ ๋ณต๊ทํ ์ ์๋๋ก ํ๋ค
Linux shell์ ์ฌ์ฉํ ๋ ๊ฒช๋ ์๋์ ๊ฐ์ ์ด๋ ค์์ tmux๋ฅผ ํตํด ํด๊ฒฐํ ์ ์๋ค
SSH Client shell์ sesion timeout
ํ๋์ ssh connection์ ์ฌ๋ฌ๊ฐ์ shell์์ ์ฌ์ฉํ๊ณ ์ถ์
Shell window๋ฅผ switch ํ๋ ๊ฒ์ด ๋ฒ๊ฑฐ๋ก์
Shell์ ์ข ๋ฃํ๋ค๊ฐ ๋ค์ ์คํ ํ์ ๋ ์ด์ ์ ์์ ๋ค์ด ๋จ์์์์ผ๋ฉด ์ข๊ฒ ์
Key features
ํ๋์ terminal window์์ ๋ค์์ windows์ pane์ ์ฌ์ฉํ๊ฒ ํด์ค๋ค
windows์ pane์ด session์ ์ ์ง๋๋๋ก ํด์ค๋ค
Internet์ด disconnect ๋์ด๋ session์ด ์ ์ง๋ ์ ์๋ค!
Session์ ๊ณต์ ํ ์ ์๋ค
Sessions, Windows, and Panes
Sessions
tmux๋ฅผ ์คํํ๋ ๊ธฐ๋ณธ ๋จ์๋ก
์ฌ๋ฌ window๋ก ๊ตฌ์ฑ๋๋ค
๊ฐ์ํ๋ ํ๋์ console์ ์์ฑํ ๊ฒ์ผ๋ก ๋ณผ ์ ์๋ค
Windows
terminal ํ๋ฉด
session ๋ด์์ tab ์ฒ๋ผ ์ฌ์ฉ ๊ฐ๋ฅํ๋ค
Panes
ํ๋์ window ๋ด์์์ ํ๋ฉด ๋ถํ
Essential tmux commands
start new session:
tmux
start new with session name:
tmux new -s SESSION_NAME
attach:
tmux a # (or at, or attach)
attach to named:
tmux a -t SESSION_NAME
list sessions:
tmux ls
exit tmux:
ctrl d
kill session:
tmux kill-session -t SESSION_NAME
Kill all the tmux sessions:
tmux ls | grep : | cut -d. -f1 | awk '{print substr($1, 0, length($1)-1)}' | xargs kill
Prefix & Shortcuts
Prefix
.tmux.conf
์์ ๋ฐ๋ก ์ค์ ์ ํ์ง ์์ผ๋ฉด, default prefix๋ctrl + b
์ด๋คprefix ์ ์๋์ commands ๋ฅผ ์กฐํฉํ์ฌ ์ฌ์ฉํ๋ค
prefix ๋ณ๊ฒฝํ๊ธฐ
vi editor๋ก $HOME ๊ฒฝ๋ก์ ~/.tmux.conf file ์ด๊ธฐ
sudo vi ~/.tmux.conf
.tmux.conf
์ ์ถ๊ฐํ ๋ด์ฉ:
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
๋ณ๊ฒฝ๋ .tmux.conf
์ ์ฉ:
tmux source-file ~/.tmux.conf
Sessions
s # list sessions
$ # name session
Windows (tabs)
c # create window
w # list windows
n # next window
p # previous window
f # find window
, # name window
& # kill window
Panes (splits)
% # vertical split
" # horizontal split
o # swap panes
q # show pane numbers
x # kill pane
+ # break pane into window (e.g. to select text by mouse to copy)
- # restore pane from window
โฝ # space - toggle between layouts
q # Show pane numbers, when the numbers show up type the key to goto that pane
{ # Move the current pane left
} # Move the current pane right
z # toggle pane zoom
Misc
d # detach
t # big clock
? # list shortcuts
: # prompt
Last updated
Was this helpful?