FreeBSD for a Linux Geek

I’ve been using Linux on a daily basis for about twenty years and have gotten to know its ins and outs fairly well. In the last couple of years I’ve had a FreeNAS server, which is built on FreeBSD, so I’ve had to learn a bit about that operating system.

On more than one occasion I’ve found myself unable to find things, or remember the name of the FreeBSD command I’ve needed. I often try the Linux equivalent and find it doesn’t work, or worse, it does something different on FreeBSD than on Linux.

This page holds notes of things I’ve learned to help me remember them the next time they come up.

Services

  • Services in FreeBSD are started and stopped by script files, analogous to those used in SysVinit distributions of Linux. The scripts are located in /etc/rc.d and /usr/local/etc/rc.d.
  • The scripts are controlled by the service command. For example:
    • service django stop
    • service django restart
  • Service configuration is in the file /etc/rc.conf. For example, to configure the ntpd service to automatically start on boot, put ntpd_enable=”YES” into that file.

System Info

  • Memory usage: vmstat fre (Linux equivalent: free -h)
  • Modules loaded: kldstat (Linux equivalent: lsmod)
  • To cause modules to be loaded on boot, add <module_name>_load=”YES” to /boot/loader.conf.