Linux – SunOS free command

linuxperlsparcsunos

I have SunOS 5.10 sparc server. I want to calculate system memory. I can easily find this in Linux using /usr/bin/free command. Can anyone please suggest me if there is any equivalent command in SunOS. It would be better if anyone can give me any Perl script to find the same in below format.

             total       used       free     shared    buffers     cached
Mem:       2257920    1725688     532232          0     354736     766032
Swap:            0          0          0
Total:     2257920    1725688     532232

Best Answer

You can obtain the physical memory information using kstat -c pages. The numbers are in pages; use the pagesize command to get the page size in bytes. Use swap -s for the current swap utilization.