Send command to all window in tmux
up vote
23
down vote
favorite
Is a way to send the same command to all window in tmux, not to all pane in window. synchronize-panes - send command to all pane in one window. I need something like 'at' in screen.
tmux gnu-screen
add a comment |
up vote
23
down vote
favorite
Is a way to send the same command to all window in tmux, not to all pane in window. synchronize-panes - send command to all pane in one window. I need something like 'at' in screen.
tmux gnu-screen
add a comment |
up vote
23
down vote
favorite
up vote
23
down vote
favorite
Is a way to send the same command to all window in tmux, not to all pane in window. synchronize-panes - send command to all pane in one window. I need something like 'at' in screen.
tmux gnu-screen
Is a way to send the same command to all window in tmux, not to all pane in window. synchronize-panes - send command to all pane in one window. I need something like 'at' in screen.
tmux gnu-screen
tmux gnu-screen
edited Nov 12 at 9:51
Vadim Kotov
4,30153247
4,30153247
asked Feb 12 '12 at 17:23
vorand
116113
116113
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
16
down vote
You could always do something like this:
session=mysession
message="hello world"
tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} $message
You could also bind this to a key in your tmux.conf like this:
bind C-e command-prompt -p "session?,message?" "run-shell "tmux list-windows -t %1 | cut -d: -f1|xargs -I{} tmux send-keys -t %1:{} %2""
1
This is great - a little addition. I wanted to do the same thing, but to send the same output to all panes in each window. Easily done with thesynchronize-panessetting!
– dsummersl
Feb 1 '13 at 0:47
1
You also get current session by command:tmux display -p "#S"
– NgaNguyenDuy
Jul 25 '16 at 0:55
so brilliant, it works!
– Zheng Qsin
Jun 2 '17 at 10:47
If you want to actually execute the command, addEnterto the above command. But then it will remove spaces in the message. You can make a function like this to deal with these points:function keys { tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} "$@" Enter}. See this question and this question, respectively, for more. But the github solution below is more thorough!
– Blue Raspberry
Nov 1 at 20:53
add a comment |
up vote
3
down vote
You could do something like this: https://gist.github.com/2773454
But this executes for every pane, but you could adjust accordingly.
All depends what your trying to accomplish, for this an example of what i want to accomplish is to source ~/.zsh in all panes.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9250884%2fsend-command-to-all-window-in-tmux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
16
down vote
You could always do something like this:
session=mysession
message="hello world"
tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} $message
You could also bind this to a key in your tmux.conf like this:
bind C-e command-prompt -p "session?,message?" "run-shell "tmux list-windows -t %1 | cut -d: -f1|xargs -I{} tmux send-keys -t %1:{} %2""
1
This is great - a little addition. I wanted to do the same thing, but to send the same output to all panes in each window. Easily done with thesynchronize-panessetting!
– dsummersl
Feb 1 '13 at 0:47
1
You also get current session by command:tmux display -p "#S"
– NgaNguyenDuy
Jul 25 '16 at 0:55
so brilliant, it works!
– Zheng Qsin
Jun 2 '17 at 10:47
If you want to actually execute the command, addEnterto the above command. But then it will remove spaces in the message. You can make a function like this to deal with these points:function keys { tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} "$@" Enter}. See this question and this question, respectively, for more. But the github solution below is more thorough!
– Blue Raspberry
Nov 1 at 20:53
add a comment |
up vote
16
down vote
You could always do something like this:
session=mysession
message="hello world"
tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} $message
You could also bind this to a key in your tmux.conf like this:
bind C-e command-prompt -p "session?,message?" "run-shell "tmux list-windows -t %1 | cut -d: -f1|xargs -I{} tmux send-keys -t %1:{} %2""
1
This is great - a little addition. I wanted to do the same thing, but to send the same output to all panes in each window. Easily done with thesynchronize-panessetting!
– dsummersl
Feb 1 '13 at 0:47
1
You also get current session by command:tmux display -p "#S"
– NgaNguyenDuy
Jul 25 '16 at 0:55
so brilliant, it works!
– Zheng Qsin
Jun 2 '17 at 10:47
If you want to actually execute the command, addEnterto the above command. But then it will remove spaces in the message. You can make a function like this to deal with these points:function keys { tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} "$@" Enter}. See this question and this question, respectively, for more. But the github solution below is more thorough!
– Blue Raspberry
Nov 1 at 20:53
add a comment |
up vote
16
down vote
up vote
16
down vote
You could always do something like this:
session=mysession
message="hello world"
tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} $message
You could also bind this to a key in your tmux.conf like this:
bind C-e command-prompt -p "session?,message?" "run-shell "tmux list-windows -t %1 | cut -d: -f1|xargs -I{} tmux send-keys -t %1:{} %2""
You could always do something like this:
session=mysession
message="hello world"
tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} $message
You could also bind this to a key in your tmux.conf like this:
bind C-e command-prompt -p "session?,message?" "run-shell "tmux list-windows -t %1 | cut -d: -f1|xargs -I{} tmux send-keys -t %1:{} %2""
answered May 6 '12 at 16:49
Alex Gaudio
1,4981411
1,4981411
1
This is great - a little addition. I wanted to do the same thing, but to send the same output to all panes in each window. Easily done with thesynchronize-panessetting!
– dsummersl
Feb 1 '13 at 0:47
1
You also get current session by command:tmux display -p "#S"
– NgaNguyenDuy
Jul 25 '16 at 0:55
so brilliant, it works!
– Zheng Qsin
Jun 2 '17 at 10:47
If you want to actually execute the command, addEnterto the above command. But then it will remove spaces in the message. You can make a function like this to deal with these points:function keys { tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} "$@" Enter}. See this question and this question, respectively, for more. But the github solution below is more thorough!
– Blue Raspberry
Nov 1 at 20:53
add a comment |
1
This is great - a little addition. I wanted to do the same thing, but to send the same output to all panes in each window. Easily done with thesynchronize-panessetting!
– dsummersl
Feb 1 '13 at 0:47
1
You also get current session by command:tmux display -p "#S"
– NgaNguyenDuy
Jul 25 '16 at 0:55
so brilliant, it works!
– Zheng Qsin
Jun 2 '17 at 10:47
If you want to actually execute the command, addEnterto the above command. But then it will remove spaces in the message. You can make a function like this to deal with these points:function keys { tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} "$@" Enter}. See this question and this question, respectively, for more. But the github solution below is more thorough!
– Blue Raspberry
Nov 1 at 20:53
1
1
This is great - a little addition. I wanted to do the same thing, but to send the same output to all panes in each window. Easily done with the
synchronize-panes setting!– dsummersl
Feb 1 '13 at 0:47
This is great - a little addition. I wanted to do the same thing, but to send the same output to all panes in each window. Easily done with the
synchronize-panes setting!– dsummersl
Feb 1 '13 at 0:47
1
1
You also get current session by command:
tmux display -p "#S"– NgaNguyenDuy
Jul 25 '16 at 0:55
You also get current session by command:
tmux display -p "#S"– NgaNguyenDuy
Jul 25 '16 at 0:55
so brilliant, it works!
– Zheng Qsin
Jun 2 '17 at 10:47
so brilliant, it works!
– Zheng Qsin
Jun 2 '17 at 10:47
If you want to actually execute the command, add
Enter to the above command. But then it will remove spaces in the message. You can make a function like this to deal with these points: function keys { tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} "$@" Enter}. See this question and this question, respectively, for more. But the github solution below is more thorough!– Blue Raspberry
Nov 1 at 20:53
If you want to actually execute the command, add
Enter to the above command. But then it will remove spaces in the message. You can make a function like this to deal with these points: function keys { tmux list-windows -t $session|cut -d: -f1|xargs -I{} tmux send-keys -t $session:{} "$@" Enter}. See this question and this question, respectively, for more. But the github solution below is more thorough!– Blue Raspberry
Nov 1 at 20:53
add a comment |
up vote
3
down vote
You could do something like this: https://gist.github.com/2773454
But this executes for every pane, but you could adjust accordingly.
All depends what your trying to accomplish, for this an example of what i want to accomplish is to source ~/.zsh in all panes.
add a comment |
up vote
3
down vote
You could do something like this: https://gist.github.com/2773454
But this executes for every pane, but you could adjust accordingly.
All depends what your trying to accomplish, for this an example of what i want to accomplish is to source ~/.zsh in all panes.
add a comment |
up vote
3
down vote
up vote
3
down vote
You could do something like this: https://gist.github.com/2773454
But this executes for every pane, but you could adjust accordingly.
All depends what your trying to accomplish, for this an example of what i want to accomplish is to source ~/.zsh in all panes.
You could do something like this: https://gist.github.com/2773454
But this executes for every pane, but you could adjust accordingly.
All depends what your trying to accomplish, for this an example of what i want to accomplish is to source ~/.zsh in all panes.
answered May 23 '12 at 6:07
DebugXYZ
657717
657717
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f9250884%2fsend-command-to-all-window-in-tmux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown