Reputation: 9986
I'd like to start tmux
from terminal, split it window and execute in the splits some commands. Furthermore, I'd like to did with bash script, that I start from terminal. Now, I've been able to start tmux
only.
#!/bin/sh
tmux
# How to split tmux window there, and start commands in splits?
Upvotes: 1
Views: 1806
Reputation: 9986
There is a script started tmux
, splitted for to panes and started ls
in the left pane and top
in the right one.
#!/bin/sh
tmux new-session -d -s main ;
tmux split-window -h ;
tmux select-pane -L
tmux send-keys -t main 'ls' C-m
tmux select-pane -R
tmux send-keys -t main 'top' C-m
tmux attach-session -d -t main
Upvotes: 4