# "free" command/perl script for freebsd



## unixdude (Nov 18, 2008)

I have a lot of friends who started out learning about unix concepts using linux. And many of them are now migrating over to freeBSD. They are used to the "free" command to look up ram/memory usage. I found a perl script written for freebsd that sort of mimics this command. I normally just use "top", "sysctl" or "vmstat" command myself. However, this is a pretty cool little perl script and might be handy in someones BSD toolbox out there. Here is the link.

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

P.S.  !Awesome! that FreeBSD.org now has this forum.

Here is what the output looks like on my computer running freeBSD-7.1 prelease using this perl script.


```
[unixdude@ ~]$ free
SYSTEM MEMORY INFORMATION:
mem_wire: 16265216 ( 15MB) [ 2%] Wired: disabled for paging out
mem_active: + 8024064 ( 7MB) [ 1%] Active: recently referenced
mem_inactive:+ 6471680 ( 6MB) [ 0%] Inactive: recently not referenced
mem_cache: + 16384 ( 0MB) [ 0%] Cached: almost avail. for allocation
mem_free: + 746426368 ( 711MB) [ 95%] Free: fully available for allocation
mem_gap_vm: + 331776 ( 0MB) [ 0%] Memory gap: UNKNOWN
-------------- ------------ ----------- ------
mem_all: = 777535488 ( 741MB) [100%] Total real memory managed
mem_gap_sys: + 14438400 ( 13MB) Memory gap: Kernel?!
-------------- ------------ -----------
mem_phys: = 791973888 ( 755MB) Total real memory available
mem_gap_hw: + 13332480 ( 12MB) Memory gap: Segment Mappings?!
-------------- ------------ -----------
mem_hw: = 805306368 ( 768MB) Total real memory installed

SYSTEM MEMORY SUMMARY:
mem_used: 52391936 ( 49MB) [ 6%] Logically used memory
mem_avail: + 752914432 ( 718MB) [ 93%] Logically available memory
-------------- ------------ ----------- ------
mem_total: = 805306368 ( 768MB) [100%] Logically total memory
```


----------



## kantor (Nov 18, 2008)

That is nice, but I think a C program would be better only because it is faster, and has lower level access


----------



## vermaden (Nov 18, 2008)

Use *[ code ]* tag for scripts output mate.


----------



## vivek (Nov 19, 2008)

vermaden said:
			
		

> Use *[ code ]* tag for scripts output mate.




```
SYSTEM MEMORY INFORMATION:
mem_wire:         443568128 (    423MB) [ 10%] Wired: disabled for paging out
mem_active:  +    244686848 (    233MB) [  5%] Active: recently referenced
mem_inactive:+   3316547584 (   3162MB) [ 80%] Inactive: recently not referenced
mem_cache:   +    101171200 (     96MB) [  2%] Cached: almost avail. for allocation
mem_free:    +     29917184 (     28MB) [  0%] Free: fully available for allocation
mem_gap_vm:  +      3284992 (      3MB) [  0%] Memory gap: UNKNOWN
-------------- ------------ ----------- ------
mem_all:     =   4139175936 (   3947MB) [100%] Total real memory managed
mem_gap_sys: +    141967360 (    135MB)        Memory gap: Kernel?!
-------------- ------------ -----------
mem_phys:    =   4281143296 (   4082MB)        Total real memory available
mem_gap_hw:  +     13824000 (     13MB)        Memory gap: Segment Mappings?!
-------------- ------------ -----------
mem_hw:      =   4294967296 (   4096MB)        Total real memory installed

SYSTEM MEMORY SUMMARY:
mem_used:         847331328 (    808MB) [ 19%] Logically used memory
mem_avail:   +   3447635968 (   3287MB) [ 80%] Logically available memory
-------------- ------------ ----------- ------
mem_total:   =   4294967296 (   4096MB) [100%] Logically total memory
```


----------



## danger@ (Nov 19, 2008)

this actually seems like rse@'s script located at http://people.freebsd.org/~rse/dist/freebsd-memory


----------



## robertclemens (Nov 19, 2008)

danger@:

It is rse@'s script hosted on a different site. Should be freely available and distributable as-is.


----------



## danger@ (Nov 19, 2008)

yup, it is


----------



## ninjaslim (Nov 19, 2008)

You can use freecolor from ports.  freecolor -o will get the job done the same way.


----------



## unixdude (Nov 20, 2008)

vermaden said:
			
		

> Use *[ code ]* tag for scripts output mate.


Your right Vermaden! I should have used the "code tag". I am trying to edit my post but unable to do so. Not sure why. I'll email the administrator and change the tagging to "code".


----------



## lme@ (Nov 20, 2008)

I just changed that.


----------



## danger@ (Nov 20, 2008)

https://forums.freebsd.org/showpost.php?p=1494&postcount=2


----------

