Megapipe Communications

FreeBSD useage

FreeBSD is a free UNIX-like operating system with similarities to GNU/Linux.

Finding OS and network information

Some ways to find basic information about your FreeBSD host.

Command Explanation
dmesg | grep memory The dmesg prints boot information, and the grep command narrows down information about memory
sysctl -a | grep hw.*mem Another way to get the above information.
sysctl -a hw.model Gets the CPU model
sysctl -a | grep -i hw.*cpu More information; will include number of CPU cores in hw.ncpu line.
pciconf -lv Print information about the PCI interfaces on the system.
sockstat -4
sockstat -6
Information about TCP/IP socket usage (different numbers represent protocol version, IPv4 or IPv6)

Filesystem Active Control Lists

These can be useful for more fine-grained control over file access. There are two ways to set FreeBSD to use filesystem ACLs:

  • Reboot in single-user mode and run tunefs on the filesystem you want to set. /sbin/tunefs -a enable / would set the root filesystem. /sbin/tunefs -a enable /usr would set the /usr filesystem, which is often a separate partition with FreeBSD (and where home directories are stored).
  • Using the acls parameter in /etc/fstab (not recommended by the FreeBSD manpage).

If you do the second option, edit /etc/fstab and look at the options column. You might have something like this:

# Device        Mountpoint      FStype  Options Dump    Pass#
/dev/raid/r0p2  /               ufs     rw      1       1
/dev/raid/r0p4  /var            ufs     rw      2       2

If you wanted your root directory / to have ACLs, you'd change the line like so:

/dev/raid/r0p2  /               ufs     rw,acls	1       1

Software installation

FreeBSD has two ways to install software: packages and ports.

Packages are installed with the pkg command

Ports are installed by fetching the ports tree and compiling the software.

Click here to return to the destinations software section.

Using bhyve

bhyve is the FreeBSD hypervisor, comparable to Linux's KVM.

Command Explanation
truncate -s 32G my_virtual_machine.img Create a 32G virtual machine image (adjust the size as you want)
vm start [name] Start a VM

Updating FreeBSD

Simple OS patching can be done via the freebsd-update command. Run as root:

freebsd-update fetch

freebsd-update install

In the /bin/sh or bash, you can likely combine these commands:

freebsd-update fetch && freebsd-update fetch install

Or, if you use sudo, you can do:

sudo freebsd-update fetch && sudo freebsd-update fetch install

Home | Services | Destinations | HelpWeb |Terms of Service | Acceptable Use | Contact Us | WebMail