... or maybe I should have asked about learning UNIX instead of BSD.
While everyone seems to think that they know what "Unix" is, it's actually very hard to find an exact definition.
It used to be that Unix was a trademark, and a set of code that was written by Dennis and Ken at Bell Labs to form an OS. Well, the trademark/copyright/patent/IP/... story got terribly complicated, and there was a long series of lawsuits, and at this point I don't even remember who owns the copyright to the term "Unix". The code that was written back then fundamentally is not running any longer: neither of the three largest Unix flavors (Linux, MacOS and *BSD) contain any Bell Labs / AT&T encumbered source code. There is probably still Bell Labs copyrights on code that is today part of Solaris, AIX and HP-UX, but those operating systems are fundamentally no longer sold, and only used in legacy environments.
Another definition of "Unix" is: All machines that pass the Posix or SUS (single Unix specification) conformance tests. That includes all the things one commonly calls Unix (Linux/MacOS/*BSD), but it also includes Windows NT and the IBM mainframe operating system zOS.
I think the only sensible definition of Unix is: Those systems commonly called Unix, which is Linux, MacOS, the BSDs, a small number of strange clones and experimental systems (Minix, Mach, seL4, Plan9 ...), and the few surviving commercial real Unixes (AIX/Solaris/HP-UX/...).
I've read that BSD takes care of everything including programs that are not part of the OS, ...
Sort of half true.
Linux is a kernel. Nothing else. You can't even make use of a system that consists purely of Linux. To get a functioning system, you need userland stuff, for example init(1) (the process that starts all other processes, for example the thing that allows one to log in), utility commands (like ls and rm), system administration stuff (like setting the IP address), programming tools (awk, python, compilers, linkers, libraries), and graphics/windowing stuff. Those things are added by distributions. Today, there are a few big ones (RedHat = Fedora, Ubuntu, Debian, ...), and lots of minor and clone ones. Typically, Linux distributions integrate the graphical UI right into the distribution.
The second biggest Unix is a special case: You can only get MacOS by buying the Mac hardware, it will only run on that. MacOS comes with all of the free software completely integrated. Yes, it includes programming environments (which is a separate download), and it makes a perfectly fine Unix development machine. But there is no choice or distribution there, everything is pre-cooked.
The *BSDs are more of a complete OS: They typically come with kernel and most of the basic command-line userland integrated. If you install FreeBSD, you get init(1), ls, rm, awk, cc, ld and all that in the main install, and it is not easily replaceable. There is also a system to install third-party packages. One thing that is different from Linux: In FreeBSD, the GUI (things like Xwindows, Gnome, KDE, ...) is not part of the OS, you just download it as a third-party package (slightly customized for FreeBSD) and install it. It is not tightly integrated, like in Linux distributions.
I've also found last week an obscure and new library (about an year old) that was made for Linux.
I don't know how a some code from, let's say github, arrive in Linux or in a BSD.
Most of the time, free software is written for Linux. That makes sense, since Linux has about 99% market share. How does it get to the Linux machine? There are two paths. One is that the Linux distribution (like Debian or RedHat) makes a copy of the software, and pre-packages it, and then you can use their package install/management tool (like yum or apt or rpm) to install it. Or you download the source, and do the install yourself (which is usually trivial, just cd into the source code, say "make install", done).
Sometimes, software designed for Linux can just be downloaded onto FreeBSD and installed there, from source. Most of the time, it requires some adjustment.That's where FreeBSD's package/port system comes in: You download the source for a "port" (which is a piece of source code, with whatever tweaks are required to make it work on FreeBSD), then compile and install it. If you are lazy (like me), you instead use the pkg system and get it pre-compiled.
I suspect there might be some automation that pulls from RedHat repos to FreeBSD. Is it so, or somebody took special care to copy this lib into FreeBSD? Asking just out of curiosity.
All done by volunteers.
I don't know how yet, or what workaround would work, but I've heard BSD-like OSs have jails, or can run Linux binaries, or use other types of virtualisations specific to BSD, so I need to learn and understand how such things work in BSD before asking more specific FreeBSD questions. That is why the question from the title.
Those are all very good and relevant questions for this forum: "On the other OS, I know how to make purple elephants fly. How do I do this on FreeBSD"? That's a very sensible and legitimate question. Where it gets ugly if people start posting things like "I hate FreeBSD, because purple elephants don't fly by default", or "why is the command on FreeBSD spelled elephant, and on Linux it is elefant, I want the version with the F." Those kinds of questions tend to get people upset.
I'll open separate topics for each subject, but I want to parse the FreeBSD docs first.
One word: HANDBOOK.