Загрузка данных


#!/bin/bash

max=0
max_pid=0

for pid in $(ls /proc | grep '^[0-9]*$')
do
    if [ -f /proc/$pid/status ]
    then
        mem=$(grep VmRSS /proc/$pid/status | awk '{print $2}')

        if [ ! -z "$mem" ]
        then
            if [ "$mem" -gt "$max" ]
            then
                max=$mem
                max_pid=$pid
            fi
        fi
    fi
done

echo "PID=$max_pid MEMORY=${max}KB"