-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtmux_example.sh
More file actions
32 lines (22 loc) · 933 Bytes
/
Copy pathtmux_example.sh
File metadata and controls
32 lines (22 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
session="youtube"
# -d tells tmux not to attach to the session that is created
tmux new-session -d -s $session
# windows and panes index starting at 0, so this is the first window
window=0
# renaming a window can help with quickly seeing which window you want
# using the prefix-key combo (deafault ctrl+b), you can give numbers to access
# windows 0 through 9
tmux rename-window -t $session:$window "htop"
# C-m tells tmux to send the keys ctrl + m, which is the same as the enter key
tmux send-keys -t $session:$window "htop" C-m
window=1
tmux new-window -t $session:$window -n "log"
# tmux can split vertically with -v or horizontally with -h
tmux split-window -v -t $session:$window
tmux select-pane -t 0
tmux send-keys -t $session:$window "tail -F ~/backup/20241109.log" C-m
tmux select-pane -t 1
tmux send-keys -t $session:$winodw "ls" C-m
tmux select-window -t $session:0
tmux attach-session -t $session