tmux script to launch several commands
Clash Royale CLAN TAG#URR8PPP
up vote
13
down vote
favorite
How can I write the following in a bash script?
tmux # Start tmux session.
compass watch /path/to/project1/compass/ # Run the first process.
Ctrl + B, " # Split the pane.
compass watch /path/to/project2/compass/ # Run the second process.
Ctrl + B, D # Exit the session.
scripting tmux
add a comment |Â
up vote
13
down vote
favorite
How can I write the following in a bash script?
tmux # Start tmux session.
compass watch /path/to/project1/compass/ # Run the first process.
Ctrl + B, " # Split the pane.
compass watch /path/to/project2/compass/ # Run the second process.
Ctrl + B, D # Exit the session.
scripting tmux
add a comment |Â
up vote
13
down vote
favorite
up vote
13
down vote
favorite
How can I write the following in a bash script?
tmux # Start tmux session.
compass watch /path/to/project1/compass/ # Run the first process.
Ctrl + B, " # Split the pane.
compass watch /path/to/project2/compass/ # Run the second process.
Ctrl + B, D # Exit the session.
scripting tmux
How can I write the following in a bash script?
tmux # Start tmux session.
compass watch /path/to/project1/compass/ # Run the first process.
Ctrl + B, " # Split the pane.
compass watch /path/to/project2/compass/ # Run the second process.
Ctrl + B, D # Exit the session.
scripting tmux
scripting tmux
edited Jun 26 '16 at 12:29
Gilles
515k12210231552
515k12210231552
asked Jun 26 '16 at 0:05
GTS Joe
18015
18015
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
15
down vote
tmux
new-session 'compass watch /path/to/project1/compass/' ;
split-window 'compass watch /path/to/project2/compass/' ;
detach-client
The new-session
command (which creates a new tmux
session) and the split-window
command (which splits the current window into two panes) in tmux
takes optional shell commands to run. The detach-client
does the obvious at the end.
When sending multiple tmux
commands to tmux
you need to separate them by ;
. The ;
needs to be protected from the shell by quoting/escaping it (';'
, ";"
or ;
), to stop the shell from interpreting it as the end of the tmux
command.
I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.
Reattach to the session with tmux a
, tmux attach
, or tmux attach-session
(these are all equivalent).
The tmux
session will end once both commands have finished executing.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
15
down vote
tmux
new-session 'compass watch /path/to/project1/compass/' ;
split-window 'compass watch /path/to/project2/compass/' ;
detach-client
The new-session
command (which creates a new tmux
session) and the split-window
command (which splits the current window into two panes) in tmux
takes optional shell commands to run. The detach-client
does the obvious at the end.
When sending multiple tmux
commands to tmux
you need to separate them by ;
. The ;
needs to be protected from the shell by quoting/escaping it (';'
, ";"
or ;
), to stop the shell from interpreting it as the end of the tmux
command.
I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.
Reattach to the session with tmux a
, tmux attach
, or tmux attach-session
(these are all equivalent).
The tmux
session will end once both commands have finished executing.
add a comment |Â
up vote
15
down vote
tmux
new-session 'compass watch /path/to/project1/compass/' ;
split-window 'compass watch /path/to/project2/compass/' ;
detach-client
The new-session
command (which creates a new tmux
session) and the split-window
command (which splits the current window into two panes) in tmux
takes optional shell commands to run. The detach-client
does the obvious at the end.
When sending multiple tmux
commands to tmux
you need to separate them by ;
. The ;
needs to be protected from the shell by quoting/escaping it (';'
, ";"
or ;
), to stop the shell from interpreting it as the end of the tmux
command.
I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.
Reattach to the session with tmux a
, tmux attach
, or tmux attach-session
(these are all equivalent).
The tmux
session will end once both commands have finished executing.
add a comment |Â
up vote
15
down vote
up vote
15
down vote
tmux
new-session 'compass watch /path/to/project1/compass/' ;
split-window 'compass watch /path/to/project2/compass/' ;
detach-client
The new-session
command (which creates a new tmux
session) and the split-window
command (which splits the current window into two panes) in tmux
takes optional shell commands to run. The detach-client
does the obvious at the end.
When sending multiple tmux
commands to tmux
you need to separate them by ;
. The ;
needs to be protected from the shell by quoting/escaping it (';'
, ";"
or ;
), to stop the shell from interpreting it as the end of the tmux
command.
I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.
Reattach to the session with tmux a
, tmux attach
, or tmux attach-session
(these are all equivalent).
The tmux
session will end once both commands have finished executing.
tmux
new-session 'compass watch /path/to/project1/compass/' ;
split-window 'compass watch /path/to/project2/compass/' ;
detach-client
The new-session
command (which creates a new tmux
session) and the split-window
command (which splits the current window into two panes) in tmux
takes optional shell commands to run. The detach-client
does the obvious at the end.
When sending multiple tmux
commands to tmux
you need to separate them by ;
. The ;
needs to be protected from the shell by quoting/escaping it (';'
, ";"
or ;
), to stop the shell from interpreting it as the end of the tmux
command.
I've split the whole thing into separate lines for readability. If you do this in a script (which I recommend), make sure there's nothing after the final on each line.
Reattach to the session with tmux a
, tmux attach
, or tmux attach-session
(these are all equivalent).
The tmux
session will end once both commands have finished executing.
edited 10 mins ago
answered Jun 26 '16 at 6:16
Kusalananda
110k15214339
110k15214339
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f292137%2ftmux-script-to-launch-several-commands%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password