sleep command using command is not displayed in ps The 2019 Stack Overflow Developer Survey Results Are InUnable to 'stuff' commands into a created 'screen' immediately after creating itRunning background process with screen command in xshellscreen command not showing status barCapturing screen of “perf top” or other interactive programsRunning repetitive task through Bash scriptbash - get pid for a script using the script filenameStart detached screen session with more than 80 columns?Unable to initiate screen sessionHow do I un-freeze my vim session under screenSearch for running script PID by script name

What is the purpose of trimming the bottom corners of TLC plates?

Where to refill my bottle in India?

Why is it "Tumoren" and not "Tumore"?

Does a dangling wire really electrocute me if I'm standing in water?

Geography at the pixel level

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?

Why is the design of haulage companies so “special”?

description of papers that have not been submitted to a venue?

The difference between dialogue marks

How can I create a character who can assume the widest possible range of creature sizes?

It's possible to achieve negative score?

sleep command using command is not displayed in ps

Unbreakable Formation vs. Cry of the Carnarium

What are the advantages and disadvantages of running one shots compared to campaigns?

Access elements in std::string where positon of string is greater than its size

Can one use the reaction spell from the War Caster feat to cast Bigby's Hand?

Python comments not highlighted with lstlisting

Are there any other methods to apply to solving simultaneous equations?

What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?

How to manage monthly salary

Can I write a for loop that iterates over both collections and arrays?

Is "plugging out" electronic devices an American expression?

JSON.serialize: is it possible to suppress null values of a map?

In What Way Would Cryomancy Affect the Food Eaten by Medieval People?



sleep command using command is not displayed in ps



The 2019 Stack Overflow Developer Survey Results Are InUnable to 'stuff' commands into a created 'screen' immediately after creating itRunning background process with screen command in xshellscreen command not showing status barCapturing screen of “perf top” or other interactive programsRunning repetitive task through Bash scriptbash - get pid for a script using the script filenameStart detached screen session with more than 80 columns?Unable to initiate screen sessionHow do I un-freeze my vim session under screenSearch for running script PID by script name



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm running the sleep command in terminal using screen and in detached mode.

Once the screen immediately returns, I'm running ps command to verify the sleep is running.



$ screen -d -m 'sleep 2m'
[raj@localhost ~]$ ps
PID TTY TIME CMD
22795 pts/0 00:00:00 bash
22869 pts/0 00:00:00 ps


But the command didn't show sleep. What is that I'm doing wrong here?










share|improve this question
























  • why would you want to run sleep through a detached screen ? couldn’t you just run it as sleep 2m & directly from your shell ? besides, ps alone shows only processes belonging to your terminal window, while whatever you run through screen will belong to a different virtual terminal

    – LL3
    3 hours ago












  • @LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried using ps -a | grep sleep still it is not showing any new process running sleep.

    – Rajkumar Natarajan
    2 hours ago


















2















I'm running the sleep command in terminal using screen and in detached mode.

Once the screen immediately returns, I'm running ps command to verify the sleep is running.



$ screen -d -m 'sleep 2m'
[raj@localhost ~]$ ps
PID TTY TIME CMD
22795 pts/0 00:00:00 bash
22869 pts/0 00:00:00 ps


But the command didn't show sleep. What is that I'm doing wrong here?










share|improve this question
























  • why would you want to run sleep through a detached screen ? couldn’t you just run it as sleep 2m & directly from your shell ? besides, ps alone shows only processes belonging to your terminal window, while whatever you run through screen will belong to a different virtual terminal

    – LL3
    3 hours ago












  • @LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried using ps -a | grep sleep still it is not showing any new process running sleep.

    – Rajkumar Natarajan
    2 hours ago














2












2








2








I'm running the sleep command in terminal using screen and in detached mode.

Once the screen immediately returns, I'm running ps command to verify the sleep is running.



$ screen -d -m 'sleep 2m'
[raj@localhost ~]$ ps
PID TTY TIME CMD
22795 pts/0 00:00:00 bash
22869 pts/0 00:00:00 ps


But the command didn't show sleep. What is that I'm doing wrong here?










share|improve this question
















I'm running the sleep command in terminal using screen and in detached mode.

Once the screen immediately returns, I'm running ps command to verify the sleep is running.



$ screen -d -m 'sleep 2m'
[raj@localhost ~]$ ps
PID TTY TIME CMD
22795 pts/0 00:00:00 bash
22869 pts/0 00:00:00 ps


But the command didn't show sleep. What is that I'm doing wrong here?







scripting gnu-screen ps






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 3 hours ago









fra-san

2,0271721




2,0271721










asked 3 hours ago









Rajkumar NatarajanRajkumar Natarajan

1347




1347












  • why would you want to run sleep through a detached screen ? couldn’t you just run it as sleep 2m & directly from your shell ? besides, ps alone shows only processes belonging to your terminal window, while whatever you run through screen will belong to a different virtual terminal

    – LL3
    3 hours ago












  • @LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried using ps -a | grep sleep still it is not showing any new process running sleep.

    – Rajkumar Natarajan
    2 hours ago


















  • why would you want to run sleep through a detached screen ? couldn’t you just run it as sleep 2m & directly from your shell ? besides, ps alone shows only processes belonging to your terminal window, while whatever you run through screen will belong to a different virtual terminal

    – LL3
    3 hours ago












  • @LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried using ps -a | grep sleep still it is not showing any new process running sleep.

    – Rajkumar Natarajan
    2 hours ago

















why would you want to run sleep through a detached screen ? couldn’t you just run it as sleep 2m & directly from your shell ? besides, ps alone shows only processes belonging to your terminal window, while whatever you run through screen will belong to a different virtual terminal

– LL3
3 hours ago






why would you want to run sleep through a detached screen ? couldn’t you just run it as sleep 2m & directly from your shell ? besides, ps alone shows only processes belonging to your terminal window, while whatever you run through screen will belong to a different virtual terminal

– LL3
3 hours ago














@LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried using ps -a | grep sleep still it is not showing any new process running sleep.

– Rajkumar Natarajan
2 hours ago






@LL3 - I'm doing it as a poc to run a command from remote machine using screen and detach from screen. I have tried using ps -a | grep sleep still it is not showing any new process running sleep.

– Rajkumar Natarajan
2 hours ago











1 Answer
1






active

oldest

votes


















6














screen expected the command in the first argument; what you gave as that first argument was: 'sleep 2m', so it tried to execute a command named (exactly) 'sleep 2m', as opposed to what you really wanted, which was sleep with an argument of 2m. The screen command exited successfully, but it did not successfully execute your command.



Use, instead:



screen -d -m sleep 2m


Instead of ps, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:



ps x


which will show it:



$ ps x
PID TTY STAT TIME COMMAND
# ...
7514 pts/1 Ss 0:00 -bash
7761 ? Ss 0:00 SCREEN -d -m sleep 2m
7762 pts/2 Ss+ 0:00 sleep 2m
7880 pts/1 R+ 0:00 ps x
# ...





share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f511443%2fsleep-command-using-command-is-not-displayed-in-ps%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









    6














    screen expected the command in the first argument; what you gave as that first argument was: 'sleep 2m', so it tried to execute a command named (exactly) 'sleep 2m', as opposed to what you really wanted, which was sleep with an argument of 2m. The screen command exited successfully, but it did not successfully execute your command.



    Use, instead:



    screen -d -m sleep 2m


    Instead of ps, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:



    ps x


    which will show it:



    $ ps x
    PID TTY STAT TIME COMMAND
    # ...
    7514 pts/1 Ss 0:00 -bash
    7761 ? Ss 0:00 SCREEN -d -m sleep 2m
    7762 pts/2 Ss+ 0:00 sleep 2m
    7880 pts/1 R+ 0:00 ps x
    # ...





    share|improve this answer



























      6














      screen expected the command in the first argument; what you gave as that first argument was: 'sleep 2m', so it tried to execute a command named (exactly) 'sleep 2m', as opposed to what you really wanted, which was sleep with an argument of 2m. The screen command exited successfully, but it did not successfully execute your command.



      Use, instead:



      screen -d -m sleep 2m


      Instead of ps, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:



      ps x


      which will show it:



      $ ps x
      PID TTY STAT TIME COMMAND
      # ...
      7514 pts/1 Ss 0:00 -bash
      7761 ? Ss 0:00 SCREEN -d -m sleep 2m
      7762 pts/2 Ss+ 0:00 sleep 2m
      7880 pts/1 R+ 0:00 ps x
      # ...





      share|improve this answer

























        6












        6








        6







        screen expected the command in the first argument; what you gave as that first argument was: 'sleep 2m', so it tried to execute a command named (exactly) 'sleep 2m', as opposed to what you really wanted, which was sleep with an argument of 2m. The screen command exited successfully, but it did not successfully execute your command.



        Use, instead:



        screen -d -m sleep 2m


        Instead of ps, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:



        ps x


        which will show it:



        $ ps x
        PID TTY STAT TIME COMMAND
        # ...
        7514 pts/1 Ss 0:00 -bash
        7761 ? Ss 0:00 SCREEN -d -m sleep 2m
        7762 pts/2 Ss+ 0:00 sleep 2m
        7880 pts/1 R+ 0:00 ps x
        # ...





        share|improve this answer













        screen expected the command in the first argument; what you gave as that first argument was: 'sleep 2m', so it tried to execute a command named (exactly) 'sleep 2m', as opposed to what you really wanted, which was sleep with an argument of 2m. The screen command exited successfully, but it did not successfully execute your command.



        Use, instead:



        screen -d -m sleep 2m


        Instead of ps, which will only show processes associated with the current terminal (of which the SCREEN and related processes are not), use:



        ps x


        which will show it:



        $ ps x
        PID TTY STAT TIME COMMAND
        # ...
        7514 pts/1 Ss 0:00 -bash
        7761 ? Ss 0:00 SCREEN -d -m sleep 2m
        7762 pts/2 Ss+ 0:00 sleep 2m
        7880 pts/1 R+ 0:00 ps x
        # ...






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 2 hours ago









        Jeff SchallerJeff Schaller

        44.8k1163145




        44.8k1163145



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • 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%2funix.stackexchange.com%2fquestions%2f511443%2fsleep-command-using-command-is-not-displayed-in-ps%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

            How should I use the fbox command correctly to avoid producing a Bad Box message?How to put a long piece of text in a box?How to specify height and width of fboxIs there an arrayrulecolor-like command to change the rule color of fbox?What is the command to highlight bad boxes in pdf?Why does fbox sometimes place the box *over* the graphic image?how to put the text in the boxHow to create command for a box where text inside the box can automatically adjust?how can I make an fbox like command with certain color, shape and width of border?how to use fbox in align modeFbox increase the spacing between the box and it content (inner margin)how to change the box height of an equationWhat is the use of the hbox in a newcommand command?

            152 Atala Notae | Nexus externi | Tabula navigationis"Discovery Circumstances: Numbered Minor Planets"2000152Small-Body Database

            Doxepinum Nexus interni Notae | Tabula navigationis3158DB01142WHOa682390"Structural Analysis of the Histamine H1 Receptor""Transdermal and Topical Drug Administration in the Treatment of Pain""Antidepressants as antipruritic agents: A review"