About

Work - Learn - Share

Lê Quang Thành : quangthanh010290@gmail.com | thanhlev@amazon.com.vn

Linux tips

Table of contents

  1. Revision history
  2. Thao tác cấp độ server
  3. Thao tác cấp độ sessions
  4. Thao tác cấp độ windows
  5. Thao tác cấp độ pannels

Revision history

Revision Date Remark
0.1 Feb-14-2023 Init document

Thao tác cấp độ server

Thao tác cấp độ sessions

tmux list-sessions
tmux ls
---
0: 1 windows (created Tue Dec 15 09:04:58 2020) [211x53]
thanhle: 1 windows (created Tue Dec 15 16:52:05 2020) [211x53] (attached)
tmux new-session -s thanhle -n pi_bluetooth -d
tmux attach-session -t thanhle
tmux a -t thanhle
tmux has-session -t thanhle
echo $? #0: có session, 1: không có session

Thao tác cấp độ windows

tmux list-windows -t thanhle
0: pi_bluetooth* (3 panes) [211x53] [layout ba54,211x53,0,0{105x53,0,0,3,105x53,106,0[105x26,106,0,4,105x26,106,27,5]}] @2 (active)
tmux new-window -t thanhle -n my_window
tmux send-keys -t thanhle:my_window 'reset' C-m
tmux send-keys -t thanhle:pi_bluetooth 'ls -al' C-m
mux split-window -h -t thanhle:my_window
tmux rename-window -t thanhle:pi_bluetooth pi
tmux kill-window -t thanhle:pi
tmux selec-window -t [window index|window name]
ctrl b w

Thao tác cấp độ pannels

tmux list-panes -t thanhle:my_window
0: [105x53] [history 0/2000, 0 bytes] %6
1: [105x53] [history 0/2000, 0 bytes] %7 (active)
tmux split-window -h -t thanhle:my_window.0
...
tmux list-panes -t thanhle:my_window
0: [52x53] [history 0/2000, 0 bytes] %6
1: [52x53] [history 0/2000, 0 bytes] %8 (active)
2: [105x53] [history 0/2000, 0 bytes] %7
tmux split-window -v -t thanhle:my_window.2
...
tmux list-panes -t thanhle:my_window
0: [52x53] [history 0/2000, 0 bytes] %6
1: [52x53] [history 0/2000, 0 bytes] %8
2: [105x26] [history 0/2000, 0 bytes] %7
3: [105x26] [history 0/2000, 0 bytes] %9 (active)
tmux send-keys -t thanhle:my_window.0 'ls -al' C-m
tmux send-keys -t thanhle:my_window.1 'ls -al' C-m
tmux send-keys -t thanhle:my_window.2 'ls -al' C-m
tmux send-keys -t thanhle:my_window.3 'ls -al' C-m
tmux kill-panel -t thanhle:my_window.x
tmux select-pane -t 0 # trên active window
tmux select-pane -t s1:thanhle.0