Show the ten processes using the most memory
Build a paste-ready command, then review its compatibility and effects before running it.
ps aux | sort -nrk 4,4 | head -10read-onlyno known side effects Compatibility
Linux + macOSVerified for Linux, macOS using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-19
Requirementspsps must be installed and available on PATH.
Version supportps Current supported releasesVerified for linux, macos using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsUSER PID %CPU %MEM VSZ RSS COMMANDRepresentative successful output; values vary with the selected target and system state.
Known errorsps: command not foundps is missing or is not available on PATH.
Verifyps aux | sort -nrk 4,4 | head -10The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01ps auxProcess snapshotLists processes for all users, including those without a terminal, with user-oriented columns.
02|PipePasses the process list to the next command.
03sort -nrk 4,4Sort by memorySorts numerically (-n), descending (-r), using only column 4 as the key (-k 4,4).
04|PipePasses the sorted rows to the final command.
05head -10Top tenKeeps only the first ten rows.
Example input
ps aux | sort -nrk 4,4 | head -10
Example output
USER PID %CPU %MEM VSZ RSS COMMAND
postgres 1842 1.2 8.4 2846152 692M postgres
node 7310 3.8 6.1 2214876 501M node server.js
Illustrative output — exact values vary by system and data.
Official sources