Sort Linux process by memory

ps aux” is used to provide information about the currently running processes. To show the currently running processes and sort it by the memory usage, you may use this command :

ps aux | sort -nk +4 | tail -n 10

ps = report a snapshot of the current processes.
a = show processes for all users
u = display the process’s user/owner
x = also show processes not attached to a terminal

This command sort the output of ps and sort it by top 10 process that takes the memory.