开发者

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

开发者 https://www.devze.com 2023-01-23 16:10 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

Closed 2 years ago.

Improve this question

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 开发者_JAVA百科   buffers     cached
Mem:        774452     733044      41408          0      98040     328880
-/+ buffers/cache:     306124     468328
Swap:      2031608        224    2031384


  • 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


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.


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.


just use old good htop

install htop

 pkg install htop

to run

htop


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


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

精彩评论

暂无评论...
验证码 换一张
取 消