0

With this cmd line I see processes and use of ram in mb

ps aux | awk '{print $6/1024 " MB\t\t" $11}' | sort -rn|less

The problem is the sort

9.95703 MB      /usr/lib/systemd/systemd-journald
9.89062 MB      /usr/sbin/winbindd
9.76953 MB      /usr/sbin/winbindd
9.69922 MB      php-fpm:
9.69922 MB      php-fpm:
9.69531 MB      php-fpm:
9.69531 MB      php-fpm:
9.69531 MB      php-fpm:
93.4297 MB      db_arc1_FREE
9.31641 MB      winbindd:
9.31641 MB      /usr/sbin/snmpd

How to sort correctly so the output became like this?

93.4297 MB      db_arc1_FREE
9.95703 MB      /usr/lib/systemd/systemd-journald
9.89062 MB      /usr/sbin/winbindd
9.76953 MB      /usr/sbin/winbindd
9.69922 MB      php-fpm:
9.69922 MB      php-fpm:
9.69531 MB      php-fpm:
9.69531 MB      php-fpm:
9.69531 MB      php-fpm:
9.31641 MB      winbindd:
9.31641 MB      /usr/sbin/snmpd
1
  • 2
    works for me. Are you sure you included the -n in the command that produced the first output? Also, this is easier with top, sort by RSS, RES, or VIRT as appropriate for your use case and version of top. Commented Nov 29, 2024 at 21:01

1 Answer 1

1
ps aux --sort=rss

or

ps aux --sort=%mem
1
  • Thanks, to get sorted from top to bottom ps aux --sort=-%mem Commented Nov 30, 2024 at 19:47

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.