On Linux, I am use to just typing "free" to see how much memory is in use and how much is available.
I use the sysinfo command on FreeBSD to view memory information. Unfortunately, I have a few issues/nitpicks with it.
* Running "sysinfo mem" prints a bit too much information, especially when ran under a virtual machines (lots of junk output on unknown voltages).
* While it can still show the desired memory information, "sysinfo mem" gives additional error information when ran as non-root.
* I'm simply use to typing "free" to get information!
So, I made the following script and saved it as /usr/local/sbin/free.
#!/bin/sh # # simple "free" command to display used & available memory # # commands used P="/usr/bin/printf" T="/usr/bin/tail" S="/usr/local/sbin/sysinfo" # check for sysinfo if [ ! -f "$S" ]; then $P "\nYou need 'sysinfo' installed for this!\n" $P "\n(run 'pkg install sysinfo' as root to install it)\n\n" exit 1 fi $P "\n" $S mem | $T -9 # EoF
Now I can just type "free" (as root or a regular user) and quickly get clean output of memory information.