The GNU ps auxf command combines several useful flags:
a: Shows processes from all usersu: Displays user-oriented formatx: Includes processes without a terminalf: Shows process hierarchy as ASCII art tree
This combination is particularly valuable for visualizing parent-child process relationships in Linux systems.
BSD-derived systems (including macOS) implement ps differently from GNU systems. Key differences:
- BSD
psdoesn't support the GNU-style combined flags - BSD uses different flag conventions (often single dash instead of no dash)
- Tree display requires different approaches
The most direct BSD equivalent would be:
ps aux -O pid,ppid,pgid,command
For the closest equivalent to ps auxf on BSD/macOS, use:
ps ax -o pid,ppid,user,pcpu,pmem,vsz,rss,start,time,command -M
To show the process hierarchy as a tree:
ps ax -o pid,ppid,command
Or for a more visual tree representation:
ps ax -o pid,ppid,command | awk '{ printf "%"$2*2"s", ""; print }'
For those who frequently need GNU-style ps behavior on macOS:
# Install GNU ps via Homebrew
brew install procps
# Then use:
gps auxf
Another useful macOS-specific command for process hierarchy:
pstree -w
Example output from BSD-style ps showing parent/child relationships:
PID PPID COMMAND
1 0 /sbin/launchd
123 1 /usr/sbin/syslogd
456 1 /usr/libexec/UserEventAgent
789 456 /usr/libexec/secinitd
To filter for a specific process tree:
ps -ef -O pid,ppid | grep [process_name]
Key columns in BSD ps output:
PID: Process IDPPID: Parent Process ID%CPU: CPU usage percentage%MEM: Memory usage percentageCOMMAND: Full command with arguments
When working on BSD-derived systems like macOS (formerly OS X), Linux users often miss the familiar ps auxf command that displays processes in a hierarchical tree structure. The BSD implementation of ps differs significantly from its GNU counterpart in both syntax and available options.
The BSD ps doesn't support the GNU-style auxf flags combination. Instead, it uses:
ps ax -o pid,user,command
However, this lacks the process tree visualization that f provides in GNU systems.
For tree-style process listing on BSD/macOS, we have several options:
1. Using pstree (if available)
Install via Homebrew on macOS:
brew install pstree
Then run:
pstree -p
2. BSD-Compatible ps Command
This provides similar output to ps auxf:
ps -axjf
3. Custom Formatting
For more control over output:
ps -ax -o pid,ppid,user,command
Here's a Bash function to mimic ps auxf behavior:
function bsd_ps_auxf() {
ps -ax -o pid,ppid,user,pcpu,pmem,vsz,rss,tt,stat,start,time,command
| awk 'NR==1; NR>1 {print $0 | "sort -k2 -n"}'
}
- BSD
psdoesn't support thefforest flag - Column headers differ between implementations
- BSD uses
-ofor custom output formatting - Memory reporting metrics vary
For those regularly switching between Linux and BSD systems, consider creating aliases in your shell configuration:
alias psauxf='ps -axjf' # For BSD/macOS
alias psauxf-linux='ps auxf' # For GNU/Linux