What is equivalent of Linux's 'free' command on FreeBSD v8.1

57.6k Views Asked by At

What is equivalent of Linux's 'free' command on FreeBSD v8.1?

I am calling 'free' from my application and reporting the results in my application's log file. What would be the replacement when porting to FreeBSD v8.1?

Here is a sample run of 'free' on Linux:

[centos4x32 ~] free
             total       used       free     shared    buffers     cached
Mem:        774452     733044      41408          0      98040     328880
-/+ buffers/cache:     306124     468328
Swap:      2031608        224    2031384
6

There are 6 best solutions below

1
On BEST ANSWER
  • vmstat has default output which is similar in nature and takes many options that give extremely detailed information, eg vmstat -m
  • swapinfo would cover the swap part
  • top -d1 causes top to print one screen and exit, and the banner is very similar to free. Use top -d1 | head -n 7 to see only the banner
0
On

You can use this script.

# fetch http://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt
# mv freebsd-memory.pl.txt /usr/local/bin/free
# chmod +x /usr/local/bin/free  

source: http://www.cyberciti.biz/faq/freebsd-command-to-get-ram-information/

0
On

just use old good htop

install htop

 pkg install htop

to run

htop
0
On

Maybe freecolor command is a choice. Install it:

# cd /usr/ports/sysutils/freecolor
# make install clean

Use it:

# freecolor
Physical  : [#################################..] 94%   (1907820/2018396)
Swap      : [###################################] 100%  (1048540/1048540)
# freecolor -m -o
             total       used       free     shared    buffers     cached
Mem:          1971        107       1863          0          0          0
Swap:         1023          0       1023

Please refer FreeBSD find out RAM size Including Total Amount of Free and Used Memory Size.

0
On

vmstat -s gives some more human-readable or script-parseable information, including listing the page size. Otherwise, it gives output in numbef of pages. With no options, vmstat gives a brief summary.

The vmstat command also exists on NetBSD.

0
On

Other option:

# vmstat fre

procs      memory      page                      faults         cpu
 r b w     avm    fre   flt  re  pi  po    fr  sr   in   sy   cs us sy id
 0 0 0  13475M    24M   689   1   2   0   344 394 14693 37734 60809  7 43 50