Script to launch mutiple terminal of terminator
I am new to terminator, where I need to launch 4 terminal. I have a script run1.sh which I want to run on first two terminal simultaneously and script run2.sh in other two terminal simultaneously.

But I want to launch the above four terminal by some script let say by script start.sh so that it itself start the terminator and split the terminator in four window and run the script run1.sh in first two window and run2.sh in other two window. Please suggest me relevant approach (it could be any python/bash/perl), as I could able to start the four window of terminator by manually and executing the command separately, which I want to do by some script. Thanks in advance!!
command-line bash scripts gnome-terminal terminator
add a comment |
I am new to terminator, where I need to launch 4 terminal. I have a script run1.sh which I want to run on first two terminal simultaneously and script run2.sh in other two terminal simultaneously.

But I want to launch the above four terminal by some script let say by script start.sh so that it itself start the terminator and split the terminator in four window and run the script run1.sh in first two window and run2.sh in other two window. Please suggest me relevant approach (it could be any python/bash/perl), as I could able to start the four window of terminator by manually and executing the command separately, which I want to do by some script. Thanks in advance!!
command-line bash scripts gnome-terminal terminator
add a comment |
I am new to terminator, where I need to launch 4 terminal. I have a script run1.sh which I want to run on first two terminal simultaneously and script run2.sh in other two terminal simultaneously.

But I want to launch the above four terminal by some script let say by script start.sh so that it itself start the terminator and split the terminator in four window and run the script run1.sh in first two window and run2.sh in other two window. Please suggest me relevant approach (it could be any python/bash/perl), as I could able to start the four window of terminator by manually and executing the command separately, which I want to do by some script. Thanks in advance!!
command-line bash scripts gnome-terminal terminator
I am new to terminator, where I need to launch 4 terminal. I have a script run1.sh which I want to run on first two terminal simultaneously and script run2.sh in other two terminal simultaneously.

But I want to launch the above four terminal by some script let say by script start.sh so that it itself start the terminator and split the terminator in four window and run the script run1.sh in first two window and run2.sh in other two window. Please suggest me relevant approach (it could be any python/bash/perl), as I could able to start the four window of terminator by manually and executing the command separately, which I want to do by some script. Thanks in advance!!
command-line bash scripts gnome-terminal terminator
command-line bash scripts gnome-terminal terminator
edited Mar 17 at 14:43
Arya
asked Mar 17 at 12:49
AryaArya
184
184
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The following shellscript works for me in Ubuntu 18.04 LTS. If you have another desktop environment, you should edit the script's wcorr and hcorr values in order to match the screen.
I suggest the name l4t for the shellscript,
#!/bin/bash
wcorr=68 # manual fix for vertical panels
hcorr=26 # manual fix for horizontal panels
tmps=$(LANG=C xrandr|grep -om1 'current.*,')
tmps=${tmps/,}
tmps=${tmps/current }
echo "screen resolution = $tmps pixels"
wscr=${tmps/ x*}
hscr=${tmps/*x }
wter=$(( (wscr-wcorr)/2 ))
hter=$(( (hscr-hcorr)/2 ))
echo "terminal width = $wter pixels"
echo "terminal height = $hter pixels"
terminator --borderless --geometry="${wter}x${hter}+0+0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}+0-0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}-0+0" -x run2.sh &
terminator --borderless --geometry="${wter}x${hter}-0-0" -x run2.sh &
I have tested the function with the following scripts run1.sh and run1.sh
run1.sh:
#!/bin/bash
cnt=0
while [ $cnt -lt 10 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt+1))
done
echo ""
bash
run1.sh:
#!/bin/bash
cnt=9
while [ $cnt -ge 0 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt-1))
done
echo ""
bash
I put a bash command at the end of these scripts. Otherwise the terminal windows would be closed after the scripts have finished. You may want to do something else.
Make the three shellscripts executable
chmod +x l4t run1.sh run2.sh
and move them to a directory in PATH,
mv l4t run1.sh run2.sh /usr/local/bin/
Now you can run them just with the name like any other command.
l4t
Thanks for your quick reply. But you did not mentioned how to start run1.sh and run2.sh from the above script ?
– Arya
Mar 17 at 15:08
1
@Arya, I have modified my answer to include running those scripts. Does it work as you want it to work?
– sudodus
Mar 17 at 17:26
@Arya, I added the option--borderlessand modifiedhcorr, which means that the [outer] title bar of the window is removed and there is more space for lines in each terminator window.
– sudodus
Mar 17 at 20:37
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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%2faskubuntu.com%2fquestions%2f1126380%2fscript-to-launch-mutiple-terminal-of-terminator%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The following shellscript works for me in Ubuntu 18.04 LTS. If you have another desktop environment, you should edit the script's wcorr and hcorr values in order to match the screen.
I suggest the name l4t for the shellscript,
#!/bin/bash
wcorr=68 # manual fix for vertical panels
hcorr=26 # manual fix for horizontal panels
tmps=$(LANG=C xrandr|grep -om1 'current.*,')
tmps=${tmps/,}
tmps=${tmps/current }
echo "screen resolution = $tmps pixels"
wscr=${tmps/ x*}
hscr=${tmps/*x }
wter=$(( (wscr-wcorr)/2 ))
hter=$(( (hscr-hcorr)/2 ))
echo "terminal width = $wter pixels"
echo "terminal height = $hter pixels"
terminator --borderless --geometry="${wter}x${hter}+0+0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}+0-0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}-0+0" -x run2.sh &
terminator --borderless --geometry="${wter}x${hter}-0-0" -x run2.sh &
I have tested the function with the following scripts run1.sh and run1.sh
run1.sh:
#!/bin/bash
cnt=0
while [ $cnt -lt 10 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt+1))
done
echo ""
bash
run1.sh:
#!/bin/bash
cnt=9
while [ $cnt -ge 0 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt-1))
done
echo ""
bash
I put a bash command at the end of these scripts. Otherwise the terminal windows would be closed after the scripts have finished. You may want to do something else.
Make the three shellscripts executable
chmod +x l4t run1.sh run2.sh
and move them to a directory in PATH,
mv l4t run1.sh run2.sh /usr/local/bin/
Now you can run them just with the name like any other command.
l4t
Thanks for your quick reply. But you did not mentioned how to start run1.sh and run2.sh from the above script ?
– Arya
Mar 17 at 15:08
1
@Arya, I have modified my answer to include running those scripts. Does it work as you want it to work?
– sudodus
Mar 17 at 17:26
@Arya, I added the option--borderlessand modifiedhcorr, which means that the [outer] title bar of the window is removed and there is more space for lines in each terminator window.
– sudodus
Mar 17 at 20:37
add a comment |
The following shellscript works for me in Ubuntu 18.04 LTS. If you have another desktop environment, you should edit the script's wcorr and hcorr values in order to match the screen.
I suggest the name l4t for the shellscript,
#!/bin/bash
wcorr=68 # manual fix for vertical panels
hcorr=26 # manual fix for horizontal panels
tmps=$(LANG=C xrandr|grep -om1 'current.*,')
tmps=${tmps/,}
tmps=${tmps/current }
echo "screen resolution = $tmps pixels"
wscr=${tmps/ x*}
hscr=${tmps/*x }
wter=$(( (wscr-wcorr)/2 ))
hter=$(( (hscr-hcorr)/2 ))
echo "terminal width = $wter pixels"
echo "terminal height = $hter pixels"
terminator --borderless --geometry="${wter}x${hter}+0+0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}+0-0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}-0+0" -x run2.sh &
terminator --borderless --geometry="${wter}x${hter}-0-0" -x run2.sh &
I have tested the function with the following scripts run1.sh and run1.sh
run1.sh:
#!/bin/bash
cnt=0
while [ $cnt -lt 10 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt+1))
done
echo ""
bash
run1.sh:
#!/bin/bash
cnt=9
while [ $cnt -ge 0 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt-1))
done
echo ""
bash
I put a bash command at the end of these scripts. Otherwise the terminal windows would be closed after the scripts have finished. You may want to do something else.
Make the three shellscripts executable
chmod +x l4t run1.sh run2.sh
and move them to a directory in PATH,
mv l4t run1.sh run2.sh /usr/local/bin/
Now you can run them just with the name like any other command.
l4t
Thanks for your quick reply. But you did not mentioned how to start run1.sh and run2.sh from the above script ?
– Arya
Mar 17 at 15:08
1
@Arya, I have modified my answer to include running those scripts. Does it work as you want it to work?
– sudodus
Mar 17 at 17:26
@Arya, I added the option--borderlessand modifiedhcorr, which means that the [outer] title bar of the window is removed and there is more space for lines in each terminator window.
– sudodus
Mar 17 at 20:37
add a comment |
The following shellscript works for me in Ubuntu 18.04 LTS. If you have another desktop environment, you should edit the script's wcorr and hcorr values in order to match the screen.
I suggest the name l4t for the shellscript,
#!/bin/bash
wcorr=68 # manual fix for vertical panels
hcorr=26 # manual fix for horizontal panels
tmps=$(LANG=C xrandr|grep -om1 'current.*,')
tmps=${tmps/,}
tmps=${tmps/current }
echo "screen resolution = $tmps pixels"
wscr=${tmps/ x*}
hscr=${tmps/*x }
wter=$(( (wscr-wcorr)/2 ))
hter=$(( (hscr-hcorr)/2 ))
echo "terminal width = $wter pixels"
echo "terminal height = $hter pixels"
terminator --borderless --geometry="${wter}x${hter}+0+0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}+0-0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}-0+0" -x run2.sh &
terminator --borderless --geometry="${wter}x${hter}-0-0" -x run2.sh &
I have tested the function with the following scripts run1.sh and run1.sh
run1.sh:
#!/bin/bash
cnt=0
while [ $cnt -lt 10 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt+1))
done
echo ""
bash
run1.sh:
#!/bin/bash
cnt=9
while [ $cnt -ge 0 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt-1))
done
echo ""
bash
I put a bash command at the end of these scripts. Otherwise the terminal windows would be closed after the scripts have finished. You may want to do something else.
Make the three shellscripts executable
chmod +x l4t run1.sh run2.sh
and move them to a directory in PATH,
mv l4t run1.sh run2.sh /usr/local/bin/
Now you can run them just with the name like any other command.
l4t
The following shellscript works for me in Ubuntu 18.04 LTS. If you have another desktop environment, you should edit the script's wcorr and hcorr values in order to match the screen.
I suggest the name l4t for the shellscript,
#!/bin/bash
wcorr=68 # manual fix for vertical panels
hcorr=26 # manual fix for horizontal panels
tmps=$(LANG=C xrandr|grep -om1 'current.*,')
tmps=${tmps/,}
tmps=${tmps/current }
echo "screen resolution = $tmps pixels"
wscr=${tmps/ x*}
hscr=${tmps/*x }
wter=$(( (wscr-wcorr)/2 ))
hter=$(( (hscr-hcorr)/2 ))
echo "terminal width = $wter pixels"
echo "terminal height = $hter pixels"
terminator --borderless --geometry="${wter}x${hter}+0+0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}+0-0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}-0+0" -x run2.sh &
terminator --borderless --geometry="${wter}x${hter}-0-0" -x run2.sh &
I have tested the function with the following scripts run1.sh and run1.sh
run1.sh:
#!/bin/bash
cnt=0
while [ $cnt -lt 10 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt+1))
done
echo ""
bash
run1.sh:
#!/bin/bash
cnt=9
while [ $cnt -ge 0 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt-1))
done
echo ""
bash
I put a bash command at the end of these scripts. Otherwise the terminal windows would be closed after the scripts have finished. You may want to do something else.
Make the three shellscripts executable
chmod +x l4t run1.sh run2.sh
and move them to a directory in PATH,
mv l4t run1.sh run2.sh /usr/local/bin/
Now you can run them just with the name like any other command.
l4t
edited Mar 18 at 6:47
answered Mar 17 at 14:36
sudodussudodus
25.6k33078
25.6k33078
Thanks for your quick reply. But you did not mentioned how to start run1.sh and run2.sh from the above script ?
– Arya
Mar 17 at 15:08
1
@Arya, I have modified my answer to include running those scripts. Does it work as you want it to work?
– sudodus
Mar 17 at 17:26
@Arya, I added the option--borderlessand modifiedhcorr, which means that the [outer] title bar of the window is removed and there is more space for lines in each terminator window.
– sudodus
Mar 17 at 20:37
add a comment |
Thanks for your quick reply. But you did not mentioned how to start run1.sh and run2.sh from the above script ?
– Arya
Mar 17 at 15:08
1
@Arya, I have modified my answer to include running those scripts. Does it work as you want it to work?
– sudodus
Mar 17 at 17:26
@Arya, I added the option--borderlessand modifiedhcorr, which means that the [outer] title bar of the window is removed and there is more space for lines in each terminator window.
– sudodus
Mar 17 at 20:37
Thanks for your quick reply. But you did not mentioned how to start run1.sh and run2.sh from the above script ?
– Arya
Mar 17 at 15:08
Thanks for your quick reply. But you did not mentioned how to start run1.sh and run2.sh from the above script ?
– Arya
Mar 17 at 15:08
1
1
@Arya, I have modified my answer to include running those scripts. Does it work as you want it to work?
– sudodus
Mar 17 at 17:26
@Arya, I have modified my answer to include running those scripts. Does it work as you want it to work?
– sudodus
Mar 17 at 17:26
@Arya, I added the option
--borderless and modified hcorr, which means that the [outer] title bar of the window is removed and there is more space for lines in each terminator window.– sudodus
Mar 17 at 20:37
@Arya, I added the option
--borderless and modified hcorr, which means that the [outer] title bar of the window is removed and there is more space for lines in each terminator window.– sudodus
Mar 17 at 20:37
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- 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%2faskubuntu.com%2fquestions%2f1126380%2fscript-to-launch-mutiple-terminal-of-terminator%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