sorted processes

Hi,
I am trying to make a script that creates a list of all active (alive) processes sorted by size and then print this list on screen.

Could anyone help me?

Thaks a lot

You can start with that :

ps -ef -o user=,pid=,ppid=,vsz=,args= | sort -k4,4n

Read man pages for ps and sort commands.

jean-Pierre.

ps -eo pid,user,args,vsz --sort vsz

Because there is no ps -o command on unix.

Any ideas ??

There is ps -o in any of the Unix or Unix like OSes I have used recently. And I would be surprised if it were not since it is required by POSIX. There is however no modern operating system simply called 'Unix'

On your system, which command do you use to display the processes and their size ?

Jean-Pierre.

I use the command ps -f
The result is something like that :

F S UID PID PPID SZ RECV TTY CMD

You can do something like that:

ps -f | tail +2 | sort -k6,6n

The header line is removed.
If you want to keep it :

ps -f | awk 'NR==1; NR>1 {print $0 | "sort -k6,6n"}'

Jean-Pierre.