FreeBSD - how to exclude some pattern with grep?

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











up vote
0
down vote

favorite












FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64



grep (GNU grep) 2.5.1-FreeBSD



Hi. I want to check availability of Asterisk process, so I use this command:



ps aux | grep /usr/local/sbin/asterisk


But the output is not relevant bacause it contains two strings (the first is for Asterisk process and the second is for grep process):



asterisk 44044 9.8 2.1 866912 133628 - Is 14:35 121:27.41 /usr/local/sbin/asterisk -n -F -U asterisk
root 44242 0.0 0.0 14796 2484 4 S+ 09:50 0:00.27 grep /usr/local/sbin/asterisk


So I want to exclude "grep" string.
In Linux I can use flag -v, but what should I do in FreeBSD?










share|improve this question

























    up vote
    0
    down vote

    favorite












    FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64



    grep (GNU grep) 2.5.1-FreeBSD



    Hi. I want to check availability of Asterisk process, so I use this command:



    ps aux | grep /usr/local/sbin/asterisk


    But the output is not relevant bacause it contains two strings (the first is for Asterisk process and the second is for grep process):



    asterisk 44044 9.8 2.1 866912 133628 - Is 14:35 121:27.41 /usr/local/sbin/asterisk -n -F -U asterisk
    root 44242 0.0 0.0 14796 2484 4 S+ 09:50 0:00.27 grep /usr/local/sbin/asterisk


    So I want to exclude "grep" string.
    In Linux I can use flag -v, but what should I do in FreeBSD?










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64



      grep (GNU grep) 2.5.1-FreeBSD



      Hi. I want to check availability of Asterisk process, so I use this command:



      ps aux | grep /usr/local/sbin/asterisk


      But the output is not relevant bacause it contains two strings (the first is for Asterisk process and the second is for grep process):



      asterisk 44044 9.8 2.1 866912 133628 - Is 14:35 121:27.41 /usr/local/sbin/asterisk -n -F -U asterisk
      root 44242 0.0 0.0 14796 2484 4 S+ 09:50 0:00.27 grep /usr/local/sbin/asterisk


      So I want to exclude "grep" string.
      In Linux I can use flag -v, but what should I do in FreeBSD?










      share|improve this question













      FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64



      grep (GNU grep) 2.5.1-FreeBSD



      Hi. I want to check availability of Asterisk process, so I use this command:



      ps aux | grep /usr/local/sbin/asterisk


      But the output is not relevant bacause it contains two strings (the first is for Asterisk process and the second is for grep process):



      asterisk 44044 9.8 2.1 866912 133628 - Is 14:35 121:27.41 /usr/local/sbin/asterisk -n -F -U asterisk
      root 44242 0.0 0.0 14796 2484 4 S+ 09:50 0:00.27 grep /usr/local/sbin/asterisk


      So I want to exclude "grep" string.
      In Linux I can use flag -v, but what should I do in FreeBSD?







      grep freebsd






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 10 mins ago









      Родинка

      4816




      4816




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for



          /usr/local/sbin/asteris[k]


          Maybe better answer: Use a program like pgrep to "look up or signal processes based on name and other attributes"





          share




















            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',
            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%2f480289%2ffreebsd-how-to-exclude-some-pattern-with-grep%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for



            /usr/local/sbin/asteris[k]


            Maybe better answer: Use a program like pgrep to "look up or signal processes based on name and other attributes"





            share
























              up vote
              0
              down vote













              Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for



              /usr/local/sbin/asteris[k]


              Maybe better answer: Use a program like pgrep to "look up or signal processes based on name and other attributes"





              share






















                up vote
                0
                down vote










                up vote
                0
                down vote









                Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for



                /usr/local/sbin/asteris[k]


                Maybe better answer: Use a program like pgrep to "look up or signal processes based on name and other attributes"





                share












                Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for



                /usr/local/sbin/asteris[k]


                Maybe better answer: Use a program like pgrep to "look up or signal processes based on name and other attributes"






                share











                share


                share










                answered 1 min ago









                Xen2050

                1,107811




                1,107811



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f480289%2ffreebsd-how-to-exclude-some-pattern-with-grep%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?