Help for Switchers from Linux to FreeBSD

Linux and FreeBSD share similarities but they are different enough to throw a new user off tracks. Therefore this cheatsheet to give the switcher a helping hand.

In my experience the man pages are a lot better than in Linux and you will often reach your goal faster by reading the man pages than by googling around. When I write something like "More info in page(8)", then a "man page" will usually do.

In addition there is the Handbook which is available in several languages.

Hardware

Devices are usually called like their driver. Thus you do not have ethXXX but for example iwnX or emX. You can find more information about the drivers in their man page. The examples here would be em(4)' and iwn(4).

Disks are not named hdX or sdX but usually daX or adaX, again like their driver. da(4)' and ada(4) are the man pages for these examples. With camcontrol devlist you will get a list of devices.

Base and Ports/Packages

In contrast to Linux FreeBSD is not a kernel and 3rd-party software combined to create a distribution. But it is split in base and ports. Base is the kernel and lots of useful tools. If you need more software than base, you need to install ports or packages.

Ports means that you get the ports tree and install from source files. It is very similar to gentoo. When you install and there are Makefile-options you get a menu that will present them to you. A faster way are packages though. Then you install from binary packages but that also means that you are bound to the dependencies bound by the packages. In my experience I cannot recommend using ports and packages together.

If you have several machines and want the best of both worlds, then use a built server like poudriere. There you can set your build options for each package, built automatically every day and update your servers with binary packages.

When you see recommendations for software, you usually see them in the style of sysutils/htop which means that it is in /usr/ports/sysutils/htop.

Run Levels, eh User Modes

Since FreeBSD does not use SysVinit there are no run levels. There is only single user mode and multi-user mode.

When you want to shutdown the system, the following commands do what you want:

More infos in shutdown(8)

You don't want to use reboot(8) usually. Reboot does not orderly shut down your system but sends them a SIGTERM or a SIGKILL and reboots. If you can, use shutdown -r now.

Services

If you need to enable services, you have to edit /etc/rc.conf or put a file with a name of the service in /etc/rc.conf.d. Usually it is something like service_enable="YES". If you don't know how the service can be enabled, have a look in the rc-script in /etc/rc.d or /usr/local/etc/rc.d. When you install for example spamassassin the service is called sa-spamd. You will usually find flags for services in the rc-script as well.

For dealing services you can usually use:

If a service is not enabled you have to prepend the action by a one:

Filesystem structure

The most important part to know is the following:

More informations are in hier(7).

Useful commands:

Different commands

zfs

With FreeBSD you have to possibility to use ZFS. It is a great file system that will make your life easier through check summing, snapshots, softraids etc. Just be aware that you leave 20% of free space or it might slow down to a level of being not usable anymore.

Important commands

More info in the Handbook; or in the man pages: zfs(8) and zpool(8).

If you want to use snapshotting for automated local backups, I recommend sysutils/zfsnap, sysutils/zfsnap2 or sysutils/life-preserver. When using X the Lumina Desktop from TrueOS has a file manager called Insight which will give you a slider to move the view of the current folder between snapshots. You need to install the Lumina Desktop (x11/lumina) to get it.

For having a safety net when doing upgrades or install new software I recommend sysutils/beadm which will give you boot environments. Practically you can create a new boot environment, play around with it and if it is broken, you can switch back to your old state. A useful blogpost is here.

LinuxFreeBSDSwitcherHelp (last edited 2018-04-01T01:02:07+0000 by MarkLinimon)