70

I’d like to view information for processes running in OS X. Running ps in the terminal just lists the open Terminal windows. How can I see all processes that are running?

Say I’m running a web browser, terminal and text editor. I’d like to see information for the text editor and web browser.

0

7 Answers 7

65

Running ps -e does the trick. Found the answer here.

3
  • 3
    Use kill [PID] aka kill 83132 to kill the desired process.
    – Rick Bross
    Commented Sep 15, 2015 at 19:58
  • 3
    ps -e coupled with grep is what I needed.
    – JMD
    Commented Oct 18, 2016 at 23:07
  • @sundaymonday Suggest you change the accepted answer to this one. Commented Jun 26, 2017 at 8:10
52

You can just use top It will display everything running on your OSX

3
  • 12
    running top only displays enough processes to fill the screen. it doesn't display "everything running". how do i see a process that isnt in the visible area of top
    – Jeff
    Commented Jan 7, 2014 at 23:38
  • 2
    Jeff, if you want the complete list, you coud use ps aux or you could sort the list of process when you open top, for example: Sort by memory usage: top -o rsize Sort by CPU usage: top -o cpu It's not exactly the whole list,
    – camilo_u
    Commented Aug 17, 2016 at 22:40
  • If you want to see a single snapshot of all processes using top, use top -l 1. -l is for "logging mode" and the one is for how many samples to output.
    – StaRbUck42
    Commented Jul 16, 2018 at 13:25
49

Using top and ps is okay, but I find that using htop is far better & clearer than the standard tools Mac OS X uses. My fave use is to hit the T key while it is running to view processes in tree view (see screenshot). Shows you what processes are co-dependent on other processes.

htop on OSX

You can install it from Homebrew using:

brew install htop

And if you have Xcode and related tools such as git installed on your system and you want to install the latest development code from the official source repository—just follow these steps.

First clone the source code from the htop GitHub repository:

git clone [email protected]:hishamhm/htop.git

Now go into the repository directory:

cd htop

Run autogen.sh:

./autogen.sh

Run this configure command:

./configure

Once the configure process completes, run make:

make

Finally install it by running sudo make install:

sudo make install
0
19

Try ps -ef. man ps will give you all the options.

 -A      Display information about other users' processes, including those without controlling terminals.

 -e      Identical to -A.

 -f      Display the uid, pid, parent pid, recent CPU usage, process start time, controlling tty, elapsed CPU usage, and the associated command.  If the -u option is also used, display
         the user name rather then the numeric uid.  When -o or -O is used to add to the display following -f, the command field is not truncated as severely as it is in other formats.
7

Try the top command. It's an interactive command that will display the running processes.

You may also use the Apple's "Activity Monitor" application (located in /Applications/Utilities/).

It provides an actually quite nice GUI. You can see all the running processes, filter them by users, get extended informations about them (CPU, memory, network, etc), monitor them, etc...

Probably your best choice, unless you want to stick with the terminal (in such a case, read the top or ps manual, as those commands have a bunch of options).

5

To sort by cpu usage: top -o cpu

3

if you are using ps, you can check the manual

man ps

there is a list of keywords allowing you to build what you need. for example to show, userid / processid / percent cpu / percent memory / work queue / command :

ps -e -o "uid pid pcpu pmem wq comm"

-e is similar to -A (all inclusive; your processes and others), and -o is to force a format.

if you are looking for a specific uid, you can chain it using awk or grep such as :

ps -e -o "uid pid pcpu pmem wq comm" | grep 501

this should (almost) show only for userid 501. try it.

The slightly GUI way

if you are a cli (ui) fan. I recommend trying https://github.com/clementtsang/bottom which shows not only processes, but also temperature, disk usage and network. Screenshot is running from kitty (terminal) as an example, I use it on OSX default terminal and the color shows up a bit different, but still amazing.

cli process monitor - bottom

The tree way

As described here : https://en.wikipedia.org/wiki/Pstree will give a better connection on the hierarchy of the processes

brew install pstree     # if you need to install it
pstree
pstree -u <user>        # show only processes by your user
pstree -s <string>      # show only processes with string
pstree -help            # show help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.