Server 16.04: Run 2+ parallel commands or multiple terminals
I'm trying to run 2 parallel commands on the server with Ubuntu Server 16.04 set on it. Or maybe (which is very doubtful) having 2+ terminals, so I could run each command in different "window".
I know that it's possible to do that by creating SSH connection and running as many commands as I want via PuTTY or some similar programs. But is that possible to achieve the same result without these extra apps (or commands like ssh
on Ubuntu Desktop)
16.04 command-line server
add a comment |
I'm trying to run 2 parallel commands on the server with Ubuntu Server 16.04 set on it. Or maybe (which is very doubtful) having 2+ terminals, so I could run each command in different "window".
I know that it's possible to do that by creating SSH connection and running as many commands as I want via PuTTY or some similar programs. But is that possible to achieve the same result without these extra apps (or commands like ssh
on Ubuntu Desktop)
16.04 command-line server
2
If you runcommand &
the '&' at the end of the command causes the command to run in the background, and subsequent commands don't wait for it to complete. This could be what you're after but I'm not sure.
– guiverc
Feb 5 at 7:33
@guiverc I tried running the command with&
at the end but it doesn't exit to the new line. So I can't run the second program after the first in this case
– Max Mikhalchuk
Feb 5 at 8:06
1
I don't know what you are trying to do, but for example if ranuptime; uptime; uptime
it would run each 'uptime' one after the other. While it's a bad example (the command is so quick it will be finished before the next starts), the commanduptime& uptime& uptime&
would (if the command took more time) run the three commands in parallel and in the background (assuming 3+ cores) & command line returns. It's easier to detect if you use commands that take awhile - though output can be jumbled on screen ... it's probably not an ideal example; but the '&' runs in background instead of ';'
– guiverc
Feb 5 at 8:21
add a comment |
I'm trying to run 2 parallel commands on the server with Ubuntu Server 16.04 set on it. Or maybe (which is very doubtful) having 2+ terminals, so I could run each command in different "window".
I know that it's possible to do that by creating SSH connection and running as many commands as I want via PuTTY or some similar programs. But is that possible to achieve the same result without these extra apps (or commands like ssh
on Ubuntu Desktop)
16.04 command-line server
I'm trying to run 2 parallel commands on the server with Ubuntu Server 16.04 set on it. Or maybe (which is very doubtful) having 2+ terminals, so I could run each command in different "window".
I know that it's possible to do that by creating SSH connection and running as many commands as I want via PuTTY or some similar programs. But is that possible to achieve the same result without these extra apps (or commands like ssh
on Ubuntu Desktop)
16.04 command-line server
16.04 command-line server
asked Feb 5 at 7:30
Max MikhalchukMax Mikhalchuk
438
438
2
If you runcommand &
the '&' at the end of the command causes the command to run in the background, and subsequent commands don't wait for it to complete. This could be what you're after but I'm not sure.
– guiverc
Feb 5 at 7:33
@guiverc I tried running the command with&
at the end but it doesn't exit to the new line. So I can't run the second program after the first in this case
– Max Mikhalchuk
Feb 5 at 8:06
1
I don't know what you are trying to do, but for example if ranuptime; uptime; uptime
it would run each 'uptime' one after the other. While it's a bad example (the command is so quick it will be finished before the next starts), the commanduptime& uptime& uptime&
would (if the command took more time) run the three commands in parallel and in the background (assuming 3+ cores) & command line returns. It's easier to detect if you use commands that take awhile - though output can be jumbled on screen ... it's probably not an ideal example; but the '&' runs in background instead of ';'
– guiverc
Feb 5 at 8:21
add a comment |
2
If you runcommand &
the '&' at the end of the command causes the command to run in the background, and subsequent commands don't wait for it to complete. This could be what you're after but I'm not sure.
– guiverc
Feb 5 at 7:33
@guiverc I tried running the command with&
at the end but it doesn't exit to the new line. So I can't run the second program after the first in this case
– Max Mikhalchuk
Feb 5 at 8:06
1
I don't know what you are trying to do, but for example if ranuptime; uptime; uptime
it would run each 'uptime' one after the other. While it's a bad example (the command is so quick it will be finished before the next starts), the commanduptime& uptime& uptime&
would (if the command took more time) run the three commands in parallel and in the background (assuming 3+ cores) & command line returns. It's easier to detect if you use commands that take awhile - though output can be jumbled on screen ... it's probably not an ideal example; but the '&' runs in background instead of ';'
– guiverc
Feb 5 at 8:21
2
2
If you run
command &
the '&' at the end of the command causes the command to run in the background, and subsequent commands don't wait for it to complete. This could be what you're after but I'm not sure.– guiverc
Feb 5 at 7:33
If you run
command &
the '&' at the end of the command causes the command to run in the background, and subsequent commands don't wait for it to complete. This could be what you're after but I'm not sure.– guiverc
Feb 5 at 7:33
@guiverc I tried running the command with
&
at the end but it doesn't exit to the new line. So I can't run the second program after the first in this case– Max Mikhalchuk
Feb 5 at 8:06
@guiverc I tried running the command with
&
at the end but it doesn't exit to the new line. So I can't run the second program after the first in this case– Max Mikhalchuk
Feb 5 at 8:06
1
1
I don't know what you are trying to do, but for example if ran
uptime; uptime; uptime
it would run each 'uptime' one after the other. While it's a bad example (the command is so quick it will be finished before the next starts), the command uptime& uptime& uptime&
would (if the command took more time) run the three commands in parallel and in the background (assuming 3+ cores) & command line returns. It's easier to detect if you use commands that take awhile - though output can be jumbled on screen ... it's probably not an ideal example; but the '&' runs in background instead of ';'– guiverc
Feb 5 at 8:21
I don't know what you are trying to do, but for example if ran
uptime; uptime; uptime
it would run each 'uptime' one after the other. While it's a bad example (the command is so quick it will be finished before the next starts), the command uptime& uptime& uptime&
would (if the command took more time) run the three commands in parallel and in the background (assuming 3+ cores) & command line returns. It's easier to detect if you use commands that take awhile - though output can be jumbled on screen ... it's probably not an ideal example; but the '&' runs in background instead of ';'– guiverc
Feb 5 at 8:21
add a comment |
1 Answer
1
active
oldest
votes
As already mentioned in comments, '&' sends the process in background. An illustrative example of & and ; is
(sleep 2; echo "2") & (sleep 3; echo "3") & (sleep 2; echo "hi") &
if you don't like the endlines:
(sleep 2; printf "2") & (sleep 3; printf "3") & (sleep 2; printf "hi") &
The three compound commands run in parallel in the background. You can just replace them with your scripts, or make use of the & operator as you see fit.
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%2f1115750%2fserver-16-04-run-2-parallel-commands-or-multiple-terminals%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
As already mentioned in comments, '&' sends the process in background. An illustrative example of & and ; is
(sleep 2; echo "2") & (sleep 3; echo "3") & (sleep 2; echo "hi") &
if you don't like the endlines:
(sleep 2; printf "2") & (sleep 3; printf "3") & (sleep 2; printf "hi") &
The three compound commands run in parallel in the background. You can just replace them with your scripts, or make use of the & operator as you see fit.
add a comment |
As already mentioned in comments, '&' sends the process in background. An illustrative example of & and ; is
(sleep 2; echo "2") & (sleep 3; echo "3") & (sleep 2; echo "hi") &
if you don't like the endlines:
(sleep 2; printf "2") & (sleep 3; printf "3") & (sleep 2; printf "hi") &
The three compound commands run in parallel in the background. You can just replace them with your scripts, or make use of the & operator as you see fit.
add a comment |
As already mentioned in comments, '&' sends the process in background. An illustrative example of & and ; is
(sleep 2; echo "2") & (sleep 3; echo "3") & (sleep 2; echo "hi") &
if you don't like the endlines:
(sleep 2; printf "2") & (sleep 3; printf "3") & (sleep 2; printf "hi") &
The three compound commands run in parallel in the background. You can just replace them with your scripts, or make use of the & operator as you see fit.
As already mentioned in comments, '&' sends the process in background. An illustrative example of & and ; is
(sleep 2; echo "2") & (sleep 3; echo "3") & (sleep 2; echo "hi") &
if you don't like the endlines:
(sleep 2; printf "2") & (sleep 3; printf "3") & (sleep 2; printf "hi") &
The three compound commands run in parallel in the background. You can just replace them with your scripts, or make use of the & operator as you see fit.
edited Feb 5 at 8:39
answered Feb 5 at 8:33
VoltBitVoltBit
863
863
add a comment |
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%2f1115750%2fserver-16-04-run-2-parallel-commands-or-multiple-terminals%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
2
If you run
command &
the '&' at the end of the command causes the command to run in the background, and subsequent commands don't wait for it to complete. This could be what you're after but I'm not sure.– guiverc
Feb 5 at 7:33
@guiverc I tried running the command with
&
at the end but it doesn't exit to the new line. So I can't run the second program after the first in this case– Max Mikhalchuk
Feb 5 at 8:06
1
I don't know what you are trying to do, but for example if ran
uptime; uptime; uptime
it would run each 'uptime' one after the other. While it's a bad example (the command is so quick it will be finished before the next starts), the commanduptime& uptime& uptime&
would (if the command took more time) run the three commands in parallel and in the background (assuming 3+ cores) & command line returns. It's easier to detect if you use commands that take awhile - though output can be jumbled on screen ... it's probably not an ideal example; but the '&' runs in background instead of ';'– guiverc
Feb 5 at 8:21