Filtering processes with top in FreeBSD

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












➥ When using top utility to view processes and their activity, how does one filter the list to a subset by name?



For example when I want to see only the processes with a name containing postgres or java.



I am using FreeBSD 11.2, but guidance across Unix flavors would be helpful if behavior varies.



I have read about using this:



top -p $(pgrep -d',' postgres)


…but I get an error:




Illegal variable name.











share|improve this question



























    up vote
    0
    down vote

    favorite












    ➥ When using top utility to view processes and their activity, how does one filter the list to a subset by name?



    For example when I want to see only the processes with a name containing postgres or java.



    I am using FreeBSD 11.2, but guidance across Unix flavors would be helpful if behavior varies.



    I have read about using this:



    top -p $(pgrep -d',' postgres)


    …but I get an error:




    Illegal variable name.











    share|improve this question

























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      ➥ When using top utility to view processes and their activity, how does one filter the list to a subset by name?



      For example when I want to see only the processes with a name containing postgres or java.



      I am using FreeBSD 11.2, but guidance across Unix flavors would be helpful if behavior varies.



      I have read about using this:



      top -p $(pgrep -d',' postgres)


      …but I get an error:




      Illegal variable name.











      share|improve this question















      ➥ When using top utility to view processes and their activity, how does one filter the list to a subset by name?



      For example when I want to see only the processes with a name containing postgres or java.



      I am using FreeBSD 11.2, but guidance across Unix flavors would be helpful if behavior varies.



      I have read about using this:



      top -p $(pgrep -d',' postgres)


      …but I get an error:




      Illegal variable name.








      process freebsd top






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 10 at 5:30









      justinnoor.io

      350218




      350218










      asked Dec 10 at 0:05









      Basil Bourque

      229314




      229314




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          The top variant provided with FreeBSD core system does not have that -p option used to select a list of pid to watch on a pseudo real-time manner.



          Nevertheless, the htop package can be installed on top of your FreeBSD system and this more colorfull top (among other things) variation have this wanted -p option.




          • htop help:

          From htop usage:



          htop 2.2.0 - (C) 2004-2018 Hisham Muhammad
          Released under the GNU GPL.

          -C --no-color Use a monochrome color scheme
          -d --delay=DELAY Set the delay between updates, in tenths of seconds
          -h --help Print this help screen
          -s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list)
          -t --tree Show the tree view by default
          -u --user=USERNAME Show only processes of a given user
          -p --pid=PID,[,PID,PID...] Show only the given PIDs
          -v --version Print version info


          • installing htop

          using FreeBSD repository:



          # pkg install htop


          or through the ports:



          # cd /usr/ports/sysutils/htop
          # make install clean





          share|improve this answer



























            up vote
            0
            down vote













            Top in designed to show the top processes, hence the name. There are, however, some work arounds that might help you.



            You can pipe the output to grep:



            top | grep postgres


            You could try the -o flag with a field name.



            top -o pid


            You can combine that with the -i flag, which takes you into interactive mode



            top -io pid


            Once there, you can toggle various options such as a for process titles, or u for user.



            Try combining the various options.



            Reference



            man top


            Freebsd 11.2 release






            share|improve this answer






















            • Helpful, but only a snapshot. I would like to see top running continually with fresh updates, but only for a subset of processes.
              – Basil Bourque
              Dec 10 at 5:30






            • 1




              Also, this picks up processes where the owner is postgres rather than the name of the process itself containing “postgres”.
              – Basil Bourque
              Dec 10 at 5:43










            • @BasilBourque I updated the answer. Hope that helps.
              – justinnoor.io
              Dec 10 at 13:42










            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%2f487022%2ffiltering-processes-with-top-in-freebsd%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
            1
            down vote













            The top variant provided with FreeBSD core system does not have that -p option used to select a list of pid to watch on a pseudo real-time manner.



            Nevertheless, the htop package can be installed on top of your FreeBSD system and this more colorfull top (among other things) variation have this wanted -p option.




            • htop help:

            From htop usage:



            htop 2.2.0 - (C) 2004-2018 Hisham Muhammad
            Released under the GNU GPL.

            -C --no-color Use a monochrome color scheme
            -d --delay=DELAY Set the delay between updates, in tenths of seconds
            -h --help Print this help screen
            -s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list)
            -t --tree Show the tree view by default
            -u --user=USERNAME Show only processes of a given user
            -p --pid=PID,[,PID,PID...] Show only the given PIDs
            -v --version Print version info


            • installing htop

            using FreeBSD repository:



            # pkg install htop


            or through the ports:



            # cd /usr/ports/sysutils/htop
            # make install clean





            share|improve this answer
























              up vote
              1
              down vote













              The top variant provided with FreeBSD core system does not have that -p option used to select a list of pid to watch on a pseudo real-time manner.



              Nevertheless, the htop package can be installed on top of your FreeBSD system and this more colorfull top (among other things) variation have this wanted -p option.




              • htop help:

              From htop usage:



              htop 2.2.0 - (C) 2004-2018 Hisham Muhammad
              Released under the GNU GPL.

              -C --no-color Use a monochrome color scheme
              -d --delay=DELAY Set the delay between updates, in tenths of seconds
              -h --help Print this help screen
              -s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list)
              -t --tree Show the tree view by default
              -u --user=USERNAME Show only processes of a given user
              -p --pid=PID,[,PID,PID...] Show only the given PIDs
              -v --version Print version info


              • installing htop

              using FreeBSD repository:



              # pkg install htop


              or through the ports:



              # cd /usr/ports/sysutils/htop
              # make install clean





              share|improve this answer






















                up vote
                1
                down vote










                up vote
                1
                down vote









                The top variant provided with FreeBSD core system does not have that -p option used to select a list of pid to watch on a pseudo real-time manner.



                Nevertheless, the htop package can be installed on top of your FreeBSD system and this more colorfull top (among other things) variation have this wanted -p option.




                • htop help:

                From htop usage:



                htop 2.2.0 - (C) 2004-2018 Hisham Muhammad
                Released under the GNU GPL.

                -C --no-color Use a monochrome color scheme
                -d --delay=DELAY Set the delay between updates, in tenths of seconds
                -h --help Print this help screen
                -s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list)
                -t --tree Show the tree view by default
                -u --user=USERNAME Show only processes of a given user
                -p --pid=PID,[,PID,PID...] Show only the given PIDs
                -v --version Print version info


                • installing htop

                using FreeBSD repository:



                # pkg install htop


                or through the ports:



                # cd /usr/ports/sysutils/htop
                # make install clean





                share|improve this answer












                The top variant provided with FreeBSD core system does not have that -p option used to select a list of pid to watch on a pseudo real-time manner.



                Nevertheless, the htop package can be installed on top of your FreeBSD system and this more colorfull top (among other things) variation have this wanted -p option.




                • htop help:

                From htop usage:



                htop 2.2.0 - (C) 2004-2018 Hisham Muhammad
                Released under the GNU GPL.

                -C --no-color Use a monochrome color scheme
                -d --delay=DELAY Set the delay between updates, in tenths of seconds
                -h --help Print this help screen
                -s --sort-key=COLUMN Sort by COLUMN (try --sort-key=help for a list)
                -t --tree Show the tree view by default
                -u --user=USERNAME Show only processes of a given user
                -p --pid=PID,[,PID,PID...] Show only the given PIDs
                -v --version Print version info


                • installing htop

                using FreeBSD repository:



                # pkg install htop


                or through the ports:



                # cd /usr/ports/sysutils/htop
                # make install clean






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Dec 10 at 12:29









                Ouki

                3,81421325




                3,81421325






















                    up vote
                    0
                    down vote













                    Top in designed to show the top processes, hence the name. There are, however, some work arounds that might help you.



                    You can pipe the output to grep:



                    top | grep postgres


                    You could try the -o flag with a field name.



                    top -o pid


                    You can combine that with the -i flag, which takes you into interactive mode



                    top -io pid


                    Once there, you can toggle various options such as a for process titles, or u for user.



                    Try combining the various options.



                    Reference



                    man top


                    Freebsd 11.2 release






                    share|improve this answer






















                    • Helpful, but only a snapshot. I would like to see top running continually with fresh updates, but only for a subset of processes.
                      – Basil Bourque
                      Dec 10 at 5:30






                    • 1




                      Also, this picks up processes where the owner is postgres rather than the name of the process itself containing “postgres”.
                      – Basil Bourque
                      Dec 10 at 5:43










                    • @BasilBourque I updated the answer. Hope that helps.
                      – justinnoor.io
                      Dec 10 at 13:42














                    up vote
                    0
                    down vote













                    Top in designed to show the top processes, hence the name. There are, however, some work arounds that might help you.



                    You can pipe the output to grep:



                    top | grep postgres


                    You could try the -o flag with a field name.



                    top -o pid


                    You can combine that with the -i flag, which takes you into interactive mode



                    top -io pid


                    Once there, you can toggle various options such as a for process titles, or u for user.



                    Try combining the various options.



                    Reference



                    man top


                    Freebsd 11.2 release






                    share|improve this answer






















                    • Helpful, but only a snapshot. I would like to see top running continually with fresh updates, but only for a subset of processes.
                      – Basil Bourque
                      Dec 10 at 5:30






                    • 1




                      Also, this picks up processes where the owner is postgres rather than the name of the process itself containing “postgres”.
                      – Basil Bourque
                      Dec 10 at 5:43










                    • @BasilBourque I updated the answer. Hope that helps.
                      – justinnoor.io
                      Dec 10 at 13:42












                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    Top in designed to show the top processes, hence the name. There are, however, some work arounds that might help you.



                    You can pipe the output to grep:



                    top | grep postgres


                    You could try the -o flag with a field name.



                    top -o pid


                    You can combine that with the -i flag, which takes you into interactive mode



                    top -io pid


                    Once there, you can toggle various options such as a for process titles, or u for user.



                    Try combining the various options.



                    Reference



                    man top


                    Freebsd 11.2 release






                    share|improve this answer














                    Top in designed to show the top processes, hence the name. There are, however, some work arounds that might help you.



                    You can pipe the output to grep:



                    top | grep postgres


                    You could try the -o flag with a field name.



                    top -o pid


                    You can combine that with the -i flag, which takes you into interactive mode



                    top -io pid


                    Once there, you can toggle various options such as a for process titles, or u for user.



                    Try combining the various options.



                    Reference



                    man top


                    Freebsd 11.2 release







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Dec 10 at 16:26

























                    answered Dec 10 at 5:06









                    justinnoor.io

                    350218




                    350218











                    • Helpful, but only a snapshot. I would like to see top running continually with fresh updates, but only for a subset of processes.
                      – Basil Bourque
                      Dec 10 at 5:30






                    • 1




                      Also, this picks up processes where the owner is postgres rather than the name of the process itself containing “postgres”.
                      – Basil Bourque
                      Dec 10 at 5:43










                    • @BasilBourque I updated the answer. Hope that helps.
                      – justinnoor.io
                      Dec 10 at 13:42
















                    • Helpful, but only a snapshot. I would like to see top running continually with fresh updates, but only for a subset of processes.
                      – Basil Bourque
                      Dec 10 at 5:30






                    • 1




                      Also, this picks up processes where the owner is postgres rather than the name of the process itself containing “postgres”.
                      – Basil Bourque
                      Dec 10 at 5:43










                    • @BasilBourque I updated the answer. Hope that helps.
                      – justinnoor.io
                      Dec 10 at 13:42















                    Helpful, but only a snapshot. I would like to see top running continually with fresh updates, but only for a subset of processes.
                    – Basil Bourque
                    Dec 10 at 5:30




                    Helpful, but only a snapshot. I would like to see top running continually with fresh updates, but only for a subset of processes.
                    – Basil Bourque
                    Dec 10 at 5:30




                    1




                    1




                    Also, this picks up processes where the owner is postgres rather than the name of the process itself containing “postgres”.
                    – Basil Bourque
                    Dec 10 at 5:43




                    Also, this picks up processes where the owner is postgres rather than the name of the process itself containing “postgres”.
                    – Basil Bourque
                    Dec 10 at 5:43












                    @BasilBourque I updated the answer. Hope that helps.
                    – justinnoor.io
                    Dec 10 at 13:42




                    @BasilBourque I updated the answer. Hope that helps.
                    – justinnoor.io
                    Dec 10 at 13:42

















                    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.





                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f487022%2ffiltering-processes-with-top-in-freebsd%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

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)