| Chess | Tools | Data | Blog | Poetry | Why? | Wiki | Admin | Logout |

Download


#!/bin/sh
# Luis Mondesi < lemsx1@gmail.com >
# 
# DESCRIPTION: a simple way to list running processes
# USAGE: lsproc [process_name]
# LICENSE: GPL
#

PS='ps -eo pid,user,rss,s,args'
if [ `uname -s` = 'Darwin' ]; then
    PS='ps -eco pid,user,rss,comm'
fi
SORT='sort --key=3 --reverse --numeric-sort'

if [ -n "$1" ]; then
    $PS | head -1 # put the header
    $PS | grep -v lsproc | grep -v PID | grep -v grep | grep $1 | $SORT
else
    $PS | head -1 # put the header
    $PS | grep -v lsproc | grep -v PID | grep -v grep | $SORT
fi

Advertisement