PID full path to executable in macOS Mojave

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












2
















ps axww -o command




This command gives me the "command" used to run the process. It also includes the "path" to the executable. I need ONLY the path. The problem is it also includes arguments with the path. I don't want the arguments.



example without args (This one is good)




/Applications/Calculator.app/Contents/MacOS/Calculator




example with args (This one isn't because it has --type=utility at the end)




/Applications/Google Chrome.app/Contents/Versions/.*.****.*/Google
Chrome Helper.app/Contents/MacOS/Google Chrome Helper --type=utility




I know I can use | cut to cut the args like this




ps axww -o command | cut -f1 -d"-"




But now I'm having to add a ton of cuts to keep up with all the different switches on the different commands.



example




ps axww -o command | cut -f1 -d"-" | cut -f1 -d"("




and so on. Is there a way to get the full file path of all currently running processes and not this hack of showing the "command" which just happens to include the path?










share|improve this question
























  • ucomm just gives me the name of the process, not its location.

    – Stuart Sloan
    Feb 21 at 17:57











  • Yes ps -ax -o comm gives me a list of all process names but not their full path location. ps -ax -o comm is also truncated to 16 characters from some reason.

    – Stuart Sloan
    Feb 21 at 18:00











  • Im on mojave also.

    – Stuart Sloan
    Feb 21 at 18:18











  • Will ps -ewwo comm work for you?

    – fd0
    Feb 22 at 7:29











  • That's it! Thank you!. I can't believe it was that easy. If you want to put it in the answer I'll accept it.

    – Stuart Sloan
    Feb 22 at 16:32















2
















ps axww -o command




This command gives me the "command" used to run the process. It also includes the "path" to the executable. I need ONLY the path. The problem is it also includes arguments with the path. I don't want the arguments.



example without args (This one is good)




/Applications/Calculator.app/Contents/MacOS/Calculator




example with args (This one isn't because it has --type=utility at the end)




/Applications/Google Chrome.app/Contents/Versions/.*.****.*/Google
Chrome Helper.app/Contents/MacOS/Google Chrome Helper --type=utility




I know I can use | cut to cut the args like this




ps axww -o command | cut -f1 -d"-"




But now I'm having to add a ton of cuts to keep up with all the different switches on the different commands.



example




ps axww -o command | cut -f1 -d"-" | cut -f1 -d"("




and so on. Is there a way to get the full file path of all currently running processes and not this hack of showing the "command" which just happens to include the path?










share|improve this question
























  • ucomm just gives me the name of the process, not its location.

    – Stuart Sloan
    Feb 21 at 17:57











  • Yes ps -ax -o comm gives me a list of all process names but not their full path location. ps -ax -o comm is also truncated to 16 characters from some reason.

    – Stuart Sloan
    Feb 21 at 18:00











  • Im on mojave also.

    – Stuart Sloan
    Feb 21 at 18:18











  • Will ps -ewwo comm work for you?

    – fd0
    Feb 22 at 7:29











  • That's it! Thank you!. I can't believe it was that easy. If you want to put it in the answer I'll accept it.

    – Stuart Sloan
    Feb 22 at 16:32













2












2








2









ps axww -o command




This command gives me the "command" used to run the process. It also includes the "path" to the executable. I need ONLY the path. The problem is it also includes arguments with the path. I don't want the arguments.



example without args (This one is good)




/Applications/Calculator.app/Contents/MacOS/Calculator




example with args (This one isn't because it has --type=utility at the end)




/Applications/Google Chrome.app/Contents/Versions/.*.****.*/Google
Chrome Helper.app/Contents/MacOS/Google Chrome Helper --type=utility




I know I can use | cut to cut the args like this




ps axww -o command | cut -f1 -d"-"




But now I'm having to add a ton of cuts to keep up with all the different switches on the different commands.



example




ps axww -o command | cut -f1 -d"-" | cut -f1 -d"("




and so on. Is there a way to get the full file path of all currently running processes and not this hack of showing the "command" which just happens to include the path?










share|improve this question

















ps axww -o command




This command gives me the "command" used to run the process. It also includes the "path" to the executable. I need ONLY the path. The problem is it also includes arguments with the path. I don't want the arguments.



example without args (This one is good)




/Applications/Calculator.app/Contents/MacOS/Calculator




example with args (This one isn't because it has --type=utility at the end)




/Applications/Google Chrome.app/Contents/Versions/.*.****.*/Google
Chrome Helper.app/Contents/MacOS/Google Chrome Helper --type=utility




I know I can use | cut to cut the args like this




ps axww -o command | cut -f1 -d"-"




But now I'm having to add a ton of cuts to keep up with all the different switches on the different commands.



example




ps axww -o command | cut -f1 -d"-" | cut -f1 -d"("




and so on. Is there a way to get the full file path of all currently running processes and not this hack of showing the "command" which just happens to include the path?







osx ps






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 21 at 23:51







Stuart Sloan

















asked Feb 21 at 17:32









Stuart SloanStuart Sloan

7919




7919












  • ucomm just gives me the name of the process, not its location.

    – Stuart Sloan
    Feb 21 at 17:57











  • Yes ps -ax -o comm gives me a list of all process names but not their full path location. ps -ax -o comm is also truncated to 16 characters from some reason.

    – Stuart Sloan
    Feb 21 at 18:00











  • Im on mojave also.

    – Stuart Sloan
    Feb 21 at 18:18











  • Will ps -ewwo comm work for you?

    – fd0
    Feb 22 at 7:29











  • That's it! Thank you!. I can't believe it was that easy. If you want to put it in the answer I'll accept it.

    – Stuart Sloan
    Feb 22 at 16:32

















  • ucomm just gives me the name of the process, not its location.

    – Stuart Sloan
    Feb 21 at 17:57











  • Yes ps -ax -o comm gives me a list of all process names but not their full path location. ps -ax -o comm is also truncated to 16 characters from some reason.

    – Stuart Sloan
    Feb 21 at 18:00











  • Im on mojave also.

    – Stuart Sloan
    Feb 21 at 18:18











  • Will ps -ewwo comm work for you?

    – fd0
    Feb 22 at 7:29











  • That's it! Thank you!. I can't believe it was that easy. If you want to put it in the answer I'll accept it.

    – Stuart Sloan
    Feb 22 at 16:32
















ucomm just gives me the name of the process, not its location.

– Stuart Sloan
Feb 21 at 17:57





ucomm just gives me the name of the process, not its location.

– Stuart Sloan
Feb 21 at 17:57













Yes ps -ax -o comm gives me a list of all process names but not their full path location. ps -ax -o comm is also truncated to 16 characters from some reason.

– Stuart Sloan
Feb 21 at 18:00





Yes ps -ax -o comm gives me a list of all process names but not their full path location. ps -ax -o comm is also truncated to 16 characters from some reason.

– Stuart Sloan
Feb 21 at 18:00













Im on mojave also.

– Stuart Sloan
Feb 21 at 18:18





Im on mojave also.

– Stuart Sloan
Feb 21 at 18:18













Will ps -ewwo comm work for you?

– fd0
Feb 22 at 7:29





Will ps -ewwo comm work for you?

– fd0
Feb 22 at 7:29













That's it! Thank you!. I can't believe it was that easy. If you want to put it in the answer I'll accept it.

– Stuart Sloan
Feb 22 at 16:32





That's it! Thank you!. I can't believe it was that easy. If you want to put it in the answer I'll accept it.

– Stuart Sloan
Feb 22 at 16:32










1 Answer
1






active

oldest

votes


















1














So on MacOS X this command works great. This was provided by @fd0




ps -ewwo comm







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%2f502138%2fpid-full-path-to-executable-in-macos-mojave%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









    1














    So on MacOS X this command works great. This was provided by @fd0




    ps -ewwo comm







    share|improve this answer



























      1














      So on MacOS X this command works great. This was provided by @fd0




      ps -ewwo comm







      share|improve this answer

























        1












        1








        1







        So on MacOS X this command works great. This was provided by @fd0




        ps -ewwo comm







        share|improve this answer













        So on MacOS X this command works great. This was provided by @fd0




        ps -ewwo comm








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 25 at 18:57









        Stuart SloanStuart Sloan

        7919




        7919



























            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%2f502138%2fpid-full-path-to-executable-in-macos-mojave%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 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?