The ps command (a.k.a process status) provides a snapshot of the current processes running on the system.

For repetitive updating of the process information (e.g. updates on how much CPU and memory each process is using, similar to Task Manager in Windows) see the top command instead.

Default Implementation

By default, ps only prints processes owned by the current user, AND are processes that are associated with the terminal that called ps. Normally this will result in quite a small amount of output, perhaps only 2-5 processes.

You will always be guaranteed these two above when running from a bash terminal, obviously bash is running, and so is the ps command (it includes itself).

More Complete Information

More complete information on the running processes of the system can be found by providing arguments, such as:

This is only a snapshot of the total number of processes it will print!

ps With grep

The output of  ps can be piped to grep to filter the results. For example, if you wanted to only look for processes with the word hocus_pocus in it:

Note: grep will match anything on the line printed by ps -aux. That means that hocus_pocus will be matched against the username column and any paths in the process name.

However, aside from having to use two commands, there are other disadvantages to using ps with grep. A completely new program, pgrep was built to try and provide a better process-searching tool.

Posted: January 29th, 2017 at 1:39 am
Last Updated on: April 27th, 2017 at 4:44 am