Server 16.04: Run 2+ parallel commands or multiple terminals












0















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)










share|improve this question


















  • 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 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
















0















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)










share|improve this question


















  • 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 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














0












0








0








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)










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 5 at 7:30









Max MikhalchukMax Mikhalchuk

438




438








  • 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 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














  • 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 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








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










1 Answer
1






active

oldest

votes


















2














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.






share|improve this answer

























    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
    });


    }
    });














    draft saved

    draft discarded


















    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









    2














    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.






    share|improve this answer






























      2














      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.






      share|improve this answer




























        2












        2








        2







        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.






        share|improve this answer















        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.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 5 at 8:39

























        answered Feb 5 at 8:33









        VoltBitVoltBit

        863




        863






























            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

            Eduardo VII do Reino Unido