Skip to content

ps command in MacOS

The ps command in MacOS is a powerful tool used to display information about processes running on your system. It allows you to view detailed information such as process ID, terminal associated with the process, and resource usages. By using various options with the ps command, you can filter and format the output to suit your needs. Understanding how to use the ps command can help you identify and manage processes effectively on your MacOS system.

Terminal window
ps [option] [parameters]
OptionDescription
-ASelect all processes except both session leaders and processes not associated with a terminal.
-aSelect all processes except both session leaders and processes not associated with a terminal.
-eSelect all processes.
-uDisplay a user-oriented output format.
-xLift the BSD-style “must have a tty” restriction.
ParameterDescription
pidProcess ID of the targeted process.
userUser name associated with the process.
commandCommand name or keyword to filter processes.
Terminal window
ps -A

Displays a list of all running processes on the system.

Terminal window
ps aux

Displays detailed information about all processes running on the system, including the user, CPU usage, memory usage, etc.

Terminal window
ps axjf

Shows the process tree, displaying the hierarchical relationship between processes.

Terminal window
ps -p 1234

Displays information about the process with the specific Process ID (PID) 1234.

Display Processes Owned by a Specific User

Section titled “Display Processes Owned by a Specific User”
Terminal window
ps -u username

Shows a list of processes owned by the specific user “username”.

Terminal window
ps aux --sort=-%cpu

Displays processes sorted by CPU usage in descending order.

Terminal window
ps auxww

Shows the full command line of processes, including arguments and options.

Monitor Real-time Changes in Process Information

Section titled “Monitor Real-time Changes in Process Information”
Terminal window
watch -n 1 'ps aux | grep processname'

Monitors real-time changes in process information for a specific process “processname”.

To use the ps command in MacOS, execute the following command:

Terminal window
ps -A

How can I list all processes with ps in MacOS?

Section titled “How can I list all processes with ps in MacOS?”

To list all processes with ps in MacOS, use the following command:

Terminal window
ps aux

How do I display process trees with ps in MacOS?

Section titled “How do I display process trees with ps in MacOS?”

To display process trees with ps in MacOS, you can use the following command:

Terminal window
ps axjf

How can I show extended information with ps in MacOS?

Section titled “How can I show extended information with ps in MacOS?”

To show extended information with ps in MacOS, run the following command:

Terminal window
ps -e -o pid,ppid,pgid,command

How do I filter processes with ps in MacOS?

Section titled “How do I filter processes with ps in MacOS?”

To filter processes with ps in MacOS, use the following command with grep:

Terminal window
ps aux | grep <process_name>

How can I sort processes by memory usage with ps in MacOS?

Section titled “How can I sort processes by memory usage with ps in MacOS?”

To sort processes by memory usage with ps in MacOS, use the following command:

Terminal window
ps aux --sort -rss

How do I show processes of a specific user with ps in MacOS?

Section titled “How do I show processes of a specific user with ps in MacOS?”

To show processes of a specific user with ps in MacOS, run the following command:

Terminal window
ps -U <username>

How do I display parent process IDs with ps in MacOS?

Section titled “How do I display parent process IDs with ps in MacOS?”

To display parent process IDs with ps in MacOS, execute the following command:

Terminal window
ps -o pid,ppid,comm

How can I refresh the display continuously with ps in MacOS?

Section titled “How can I refresh the display continuously with ps in MacOS?”

To refresh the display continuously with ps in MacOS, use the watch command along with ps:

Terminal window
watch -n 1 'ps aux'
  • Viewing information about running processes
  • Showing details about specific processes
  • Checking resource utilization of processes
  • Displaying a snapshot of the current processes
  • Monitoring system activity and performance