Terminal help

Discussion in 'macOS' started by mnemonicj, Mar 26, 2012.

  1. mnemonicj macrumors member

    mnemonicj

    Joined:
    Nov 11, 2010
    Location:
    Hsinchu, Taiwan
    #1
    Good day people.

    I'm currently looking for a command for my terminal that can show me if a certain process is running. I want to be able to filter out the process by name not by running its current PID.

    Any chance of that happening?

    Regards.
     
  2. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #2
    Use Activity Monitor. It's much simpler.
     
  3. mnemonicj thread starter macrumors member

    mnemonicj

    Joined:
    Nov 11, 2010
    Location:
    Hsinchu, Taiwan
    #3
    Thanks for the reply.

    Unfortunately, I want to be able to monitor such processes remotely connected through an ssh tunnel. That's why I'm forced to use a terminal.
     
  4. nDarkness macrumors newbie

    Joined:
    Jan 10, 2012
    #4
    Top will do it for you.

    To see processes and sort by cpu usage, type:
    top -o cpu

    This is the listing you get from activity monitor.
     
  5. ScoobyMcDoo macrumors 65816

    Joined:
    Nov 26, 2007
    Location:
    Austin, TX
    #5
    How about piping the output of ps to grep:

    ps axc |grep <process-name>
     
  6. r0k macrumors 68040

    r0k

    Joined:
    Mar 3, 2008
    Location:
    Detroit
    #6
    Agree with top except it only shows the top dozen or so processes. I use PS and grep for the name of the process I'm looking for, ie

    Code:
    ps -ax | grep python
     
  7. mnemonicj thread starter macrumors member

    mnemonicj

    Joined:
    Nov 11, 2010
    Location:
    Hsinchu, Taiwan
    #7
    Will grep work with cygwin? Better yet, will this code work work with cygwin at all?
     
  8. mfram macrumors 65816

    Joined:
    Jan 23, 2010
    Location:
    San Diego, CA USA
    #8
    grep will almost surely be there. It's pretty basic. Whether the 'ps' command works in cygwin, I dunno.
     
  9. r0k macrumors 68040

    r0k

    Joined:
    Mar 3, 2008
    Location:
    Detroit
    #9
    Why are you asking about cygwin in an OSX forum? I seem to recall cygwin is a windows thing.

    On OSX, ps works just fine. In Windows running under bootcamp or parallels I don't know if ps would work under PS but even if it did work it would only "see" the process inside the windows VM, but I'd have to ask myself why you'd bother with cygwin when you have OSX at your disposal?
     
  10. nDarkness macrumors newbie

    Joined:
    Jan 10, 2012
    #10
    Are sshing into the mac or windows box? If you are going to the windows box use pstools. There is a utility called pslist that will show you all processes. If you are going to the mac use the suggestions above.
     
  11. mnemonicj thread starter macrumors member

    mnemonicj

    Joined:
    Nov 11, 2010
    Location:
    Hsinchu, Taiwan
    #11
    Thanks a lot for the replies people. I am using a Mac to connect to a windows box and vice-versa. I'll try these commands and post back. I'll look into pstools.
     
  12. mnemonicj thread starter macrumors member

    mnemonicj

    Joined:
    Nov 11, 2010
    Location:
    Hsinchu, Taiwan
    #12
    All of the above suggestions work on my Mac and I know this isn't the place to post about Cygwin, but unfortunately the commands you all mentioned do not work on it. Thanks a lot for the replies!
     
  13. mnemonicj thread starter macrumors member

    mnemonicj

    Joined:
    Nov 11, 2010
    Location:
    Hsinchu, Taiwan
    #13
    Thank you everyone. The following command works:

    ps -W | grep "process name"

    Regards.
     

Share This Page