cpu, memory and virtual memory usage

Hi All,

Does anyone know what the best commands in the UNIX command line are for obtaining this info:

current CPU usage
memory usage
virtual memory usage

preferably with date and time parameters too?

thanks

ocelot

top shows cpu %, vmstat shows memory and virtual memory. A lot of unix-es come with different packages for gathering performance data. HPUX has glance, for example, which shows a lot of system statistics.

What UNIX do you have?

i have sun solaris version 5.8. I have tried top but that doesnt seem to work unfortunately...

thanks

Solaris 8 comes with prstat which is close the top output - see the prstat man page for more info. If your system is running sar via crontab, you can look at it's output also - see the man page for sar.

Example of sar
In user "sys" crontab
0,10,20,30,40,50 * * * * /usr/lib/sa/sa1

That creates files in /var/adm/sa - use the following command to see aspects of how the server was running for yesterday (the 19th)
sar -qucgf /var/adm/sa/sa19

Caution - before turning on sar via crontab, make sure you have the room for the files in /var/adm/sa - they can get rather big.

You can also use vmstat to show cpu and memory - see the vmstat man page.

Please help me reagarding the calculation of virtual memory of a process.

How to calculate the VM of a running process with agiven PID on Solaris.
Please explain the difference between physical memory used by a process and virtual memory used by it.
Which one if\s of utmost importance if we need to alert on memory usage exceeding a given threshold.

Regards.