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

How do I find out RAM size or memory size installed in my FreeBSD server? How do I display amount of free and used memory in the system powered by FreeBSD? How do I find out how much RAM is installed on a FreeBSD 10 or 11 server? To displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel you need to install special script or package. Most FreeBSD user use the sysctal command to get all data. There is a perl script that automates everything and display back result on screen.

FreeBSD command about RAM size and information

This script query the system through the generic sysctl interface. The sysctl utility retrieves kernel state and allows processes with appropriate privilege to set kernel state. You must have perl installed on FreeBSD. First, download a Perl script which is written by Ralf S. Engelschall:$ fetch http://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt $ sudo mv freebsd-memory.pl.txt /usr/local/bin/free $ sudo chmod +x /usr/local/bin/free

Make sure perl is installed on your system (which perl$ free Sample outputs:

You can avoid Perl based code and use standard sh shell to get same info using freebsd-memory.sh script:$ fetch https://raw.githubusercontent.com/ocochard/myscripts/master/FreeBSD/freebsd-memory.sh ## or use curl command ## ## $ curl -O https://raw.githubusercontent.com/ocochard/myscripts/master/FreeBSD/freebsd-memory.sh $ sh freebsd-memory.sh Sample outputs from my FreeBSD based home router:

-b Display the amount of memory in bytes.
-k Display the amount of memory in kilobytes. This is the default.
-m Display the amount of memory in megabytes.
-o Display the output in old format, the only difference being this
option will disable the display of the "buffer adjusted" line.
-s Continuously display the result delay seconds apart. You may
actually specify any floating point number for delay, usleep(3)
is used for microsecond resolution delay times.
-t Display a line showing the column totals.
-V Display version information.

Here is a sample demo from my server:

Gif.01: Find out how much RAM is installed on my FreeBSD box

Use top command

The top display and update information about the top cpu processes including "Physical Memory Stats" as follows (from top(1) man page):