#!/bin/bash
PIDDIR=/proc/
PID=0
PIDNAME=''
VMSIZE=0
VMRSS=0
LISTPID=`ls ${PIDDIR} | grep ^[1-9] | sort -n`
for I in ${LISTPID};do
PIDNAME=`cat ${PIDDIR}${I}/status 2> /dev/null | grep Name: | awk '{print $2}'`
PID=`cat ${PIDDIR}${I}/status 2> /dev/null | grep "^Pid:" | awk '{print $2}'`
VMSIZE=`cat ${PIDDIR}${I}/status 2> /dev/null | grep VmSize: | awk '{print $2}'`
VMRSS=`cat ${PIDDIR}${I}/status 2> /dev/null | grep VmRSS: | awk '{print $2}'`
echo "Name: ${PIDNAME} PID: ${PID} VMSIZE: ${VMSIZE} VMRSS: ${VMRSS}" >> /root/pid.txt
done