BSD: What Is It, and How Is It Different From Linux?
Linux & macOS Terminal
Summary
- BSD is descended from Unix, while Linux was written as a lookalike of Unix.
- BSD and Linux use different kernels and package managers. BSD is closer to a pure Unix experience.
- The FreeBSD installer is no-frills and terminal-based, and there are post-installation steps if you want to have a graphical desktop environment.
Looking around at lesser-known operating systems, you’ve likely come across something called BSD, or FreeBSD. Both Linux and BSD are open source, Unix-like operating systems, but they’re different. Here’s what you need to know.
BSD Is Dead, Long Live BSD
Linux is a built-from-scratch facsimile of Unix, but BSD is actually descended from Unix. Unix is an operating system developed at Bell Labs in the late 1960s. When two of the Unix lead developers presented a paper at a conference in 1973, interested parties requested copies of their new OS.
Because of trade restrictions on AT&T—Bell’s parent company—Bell couldn’t treat Unix as a product with a revenue stream. To side-step the restrictions, Bell distributed copies of Unix as source code and a license, for a very small fee to cover shipping. The University of California, Berkeley was one of many Universities that took up that offer.
Ken Thompson, the chief architect of Unix, took a sabbatical from Bell to work as a visiting professor at Berkeley. Along with some graduate students, he worked on adding useful tools and important modifications. Bill Joy, a graduate student who later co-founded Sun Microsystems, made significant contributions, including virtual memory handling, and the TCP/IP networking stack.
Interest grew in the Berkeley improvements, so they were made available as an add-on pack to Unix, called the Berkeley Software Distribution, or BSD. Because having Unix was a prerequisite, users still had to obtain a Unix license. An initiative spearheaded by Keith Bostic gradually replaced the AT&T code with code written at Berkeley, creating a freely-available Unix-like operating system incorporating the BSD improvements.
A version that would run on Intel 80386 processors was created, called 386BSD, giving birth to BSD on the desktop PC. 386BSD was forked to create the FreeBSD operating system.
The original BSD became obsolete, but lives on in FreeBSD and its other direct descendants—and in some surprising places.
How BSD Differs from Linux
Apart from lineage and heritage, there are differences between Linux and the remaining BSDs, the most popular of which is FreeBSD. FreeBSD is a Unix-like operating system but, like Linux, it is not a certified uppercase UNIX.
A major difference is the kernel. FreeBSD has its own kernel. It doesn’t use the Linux kernel. A heavily modified version of the BSD kernel is used in macOS which is, ironically, a certified UNIX.
You’ll find all the usual command line tools for a Unix-like operating system, but check the man pages before you use them. If you’re familiar with the Linux versions of the tools, you’ll see differences in the options of many of the FreeBSD ones. It doesn’t stop you from doing what you need to get done, but it will make you stumble here and there.
It is possible to run Linux apps on FreeBSD but this requires some extra work, such as using Docker images or installing a Linux compatibility layer. There are over 36,000 native FreeBSD applications though, so you might not need to run any Linux software at all.
There are two ways to install applications on FreeBSD. Ports use source code which is compiled locally on your own computer. Binary packages are available too, managed with pkg, the FreeBSD package manager.
Hardware compatibility can be a problem with FreeBSD, especially on laptops, where getting Bluetooth, Wi-Fi, or sound to work can be a challenge, or even impossible. But, once it is up and running, FreeBSD has a great reputation for stability, with many FreeBSD users adopting it for home servers even if they don’t use it as a desktop operating system.
Some of FreeBSD’s stability might be a result of its smaller developer community, which moves at a much slower pace than the Linux distribution communities. Whatever the opposite of move fast and break things is, that’s the FreeBSD mentality, and it’s evidently paying off.
Another major difference is the license. FreeBSD uses the 2-clause BSD license, which allows proprietary use of FreeBSD, and also its incorporation into proprietary products. It also allows modifications to the source code to be considered proprietary and non-public.
Using FreeBSD
The FreeBSD installer sports a text-based user interface.
It might feel like something from the early 1990s, but it works and offers a reasonable degree of hand-holding.
After the installation, you’ll have a working version of FreeBSD, but it is command line only. You won’t have a desktop environment. If you want one, you need to install one. This makes sense. If you’re running a home server, you probably won’t bother with a graphical desktop.
I installed GNOME, which only took a few minutes. All told, the installation process lasted about ten minutes, not counting the time to download the FreeBSD ISO image. The version of GNOME seemed to be a plain vanilla, unadulterated, GNOME, like you’d get with Fedora or Arch.
Installing software was simple. Using pkg is similar to using pacman, dnf, or apt. To install rsync, I first swapped user to root, with the su command.
su root
The last character of the command prompt is a pound sign ‘#’ when you’re root. As a regular user, it is a dollar sign ‘$.’
As root, I ran the pkg command.
When you’re finished using root, you need to log out so you return to your regular user. You can do this by typing exit or pressing Ctrl+D.
Note that the default shell is sh, not Bash. The sh shell is POSIX compliant, while Bash doesn’t try to be. If you’re used to Bash, you’ll be fine, but be careful when you’re writing scripts, some of the Bash extensions won’t be present, such as double bracket [[ ]] comparisons.
There are differences on the command line too. For example, sh doesn’t have anything similar to Bash job control functionality.
A Surprisingly Wide Legacy
It’s great to see the spirit of BSD kept alive in the BSDs of today, and interesting to think that at the heart of macOS and iOS is a kernel partly built on the BSD kernel, and that Microsoft used the BSD TCP/IP stack to implement its Winsock library and its own TCP/IP networking routines.
FreeBSD and the other BSDs will give you a much purer Unix experience than you’ll get from Linux. If that’s not important to you, Linux will give you a smoother ride on a broader range of hardware.