Introduction
FreeBSD is a free operating system derived from ATT's UNIX operating system FreeBSD no longer contains anyATT proprietary code, so it may be distributed freely. See page 7 for more details. It runs on the following platforms:
Computers based on the Intel i386 CPU architecture, including the 386, 486 and Pentium families of processors, and compatible CPUs from AMD and Cyrix.
The Compaq/Digital Alpha processor.
64 bit SPARC machines from Sun Microsystems.
In addition, significant development efforts are going towards porting FreeBSD to other hardware, notably the Intel 64 bit architecture and the IBM/Motorola PowerPC architecture.
This course describes the released versions of FreeBSD for Intel and Alpha processors. Current support for SPARC 64 processors is changing too fast for it to be practical to give details specific to this processor, but nearly everything in this course also applies to SPARC 64.
How to use this course
This course is intended for a number of different audiences. It attempts to present the material without too many forward references. It contains the following parts:
The first part, Chapters 1 to 6, tells you howtoinstall FreeBSD and what to do if things go wrong.
Chapters 7to15introduce you to life with FreeBSD, including setting up optional features and system administration.
Chapters 16 to 27 introduce you to FreeBSD's rich network support.
Finally, Chapters 28 to 33 look at system administration topics that build on all the preceding material.
In more detail, we'll discuss the following subjects:
In the rest of this chapter, we’ll look at what FreeBSD is, what you need to run it, and what resources are available, including FreeBSD's features and history, how it compares to other free UNIX-like operating systems, other sources of information about FreeBSD, the world-wide FreeBSD community, and support for FreeBSD. In addition, we'll look at the BSD'sdaemon emblem.
Chapter 2, Before you install, discusses the installation requirements and theoretical background of installing FreeBSD.
Chapter 3, Quick installation, presents a quick overview of the installation process. If you're reasonably experienced, this may be all you need to install FreeBSD.
In Chapter 4, Shared OS installation,we'll look at preparing to install FreeBSD on a system that already contains another operating system.
In Chapter 5, Installing FreeBSD,we'll walk through a typical installation in detail.
Chapter 6, Post-installation configuration,explains the configuration you need to do after installation to get a complete functional system.
Chapter 7, The tools of the trade, presents a number of aspects of FreeBSD that are of interest to newcomers (particularly from a Microsoft environment). We'll look at setting up a desktop, the concept of users and file naming. We’ll also consider the basics of using the shell and editor, and how to shut down the machine.
Chapter 8, Taking control, goes into more detail about the specifics of working with UNIX, such as processes, daemons, timekeeping and log files. We’ll also look at features unique to FreeBSD, including multiple processor support, removable I/O devices and emulating other systems.
Chapter 9, The Ports Collection,describes the thousands of free software packages that you can optionally install on a FreeBSD system.
Chapter 10, File systems and devices, contains information about the FreeBSD directory structure and device names. You'll find the section on device names (starting on page 195) interesting even if you're an experienced UNIX hacker.
Chapter 11, Disks, describes how to format and integrate hard disks, and how to handle disk errors.
Managing disks can be a complicated affair. Chapter 12, The Vinum Volume Manager, describes a way of managing disk storage.
In Chapter 13, Writing CD-Rs, we'll look at how to use FreeBSD to write CD-Rs.
FreeBSD provides professional, reliable data backup services as part of the base system. Don't ever let yourself lose data because of inadequate backup provisions. Read all about it in Chapter 14, Tapes, backups and floppy disks.
Chapter 15, Printers, describes the BSD spooling system and how to use it both on local and networked systems.
Starting at Chapter 16, Networks and the Internet, we’ll look at the Internet and the more important services.
Chapter 17, Configuring the local network, describes how to set up local networking.
Chapter 18, Connecting to the Internet, discusses the issues in selecting an Internet Service Provider (ISP) and establishing a presence on the Internet.
Chapter 19, Serial communications, discusses serial hardware and the prerequisites for PPP and SLIP communications.
In Chapter 20, Configuring PPP,we'll look at FreeBSD's two PPP implementations and what it takes to set them up.
In Chapter 21, The Domain Name Service, we'll consider the use of names on the Internet.
Security is an increasing problem on the Internet. In Chapter 22, Fire walls, IP aliasing and proxies,we'll look at some things we can do to improve it. We'll also look at IP aliasing, since it goes hand-in-hand with firewalls, and proxy servers.
Networks sometimes become not works. In Chapter 23, Network debugging, we’ll see what we can do to solve net work problems.
Chapter 24, Basic network access: clients,describes the client viewpoint of network access, including Web browsers, ssh, ftp, rsync and nfs clients for sharing file systems between networked computers.
Network clients talk to network servers. We'll look at the corresponding server viewpoint in Chapter 25, Basic network access: servers.
Despite the World Wide Web, traditional two-way personal communication is still very popular. We'll look at how to use mail clients in Chapter 26, Electronic mail: clients.
Mail servers are an important enough topic that there's a separate Chapter 27, Electronic mail: servers.
In Chapter 28, XFree86 in depth, we'll look at the theory behind getting X11 working.
Chapter 29, Starting and stopping the system, describes how to start and stop a FreeBSD system and all the things you can do to customize it.
In Chapter 30, FreeBSD configuration files, we'll look at the more common configuration files and what they should contain.
In Chapter 31, Keeping up to date, we’ll discuss howtoensure that your system is always running the most appropriate version of FreeBSD.
FreeBSD keeps changing. We'll look at some aspects of what that means to you in Chapter 32, Updating the system software.
Chapter 33, Custom kernels, discusses optional kernel features.
Appendix A, Bibliography,suggests some books for further reading.
Appendix B, The evolution of FreeBSD, describes the changes that have taken place in FreeBSD since it was introduced nearly ten years ago.
FreeBSD features
FreeBSD is derived from Berkeley UNIX,the flavour of UNIX developed by the Computer Systems Research Group at the University of California at Berkeley and previously released as the Berkeley Software Distribution (BSD) of UNIX.
UNIX is a registered trademark of the Open Group, so legally; FreeBSD may not be called UNIX. The technical issues are different, of course; makeup your own mind as to how much difference this makes.
Like commercial UNIX, FreeBSD provides you with many advanced features, including:
FreeBSD uses preemptive multitasking with dynamic priority adjustment to ensure smooth and fair sharing of the computer between applications and users.
FreeBSD is a multi-user system:many people can use a FreeBSD system simultaneously for unrelated purposes. The system shares peripherals such as printers and tape drives properly between all users on the system.
Don't get this confused with the multitasking offered by some commercial systems. FreeBSD is a true multi-user system that protects users from each other.
FreeBSD is secure. Its track record is borne out by the reports of the CERT,the leading organization dealing with computer security. See http://www.cert.org for more information. The FreeBSD project has a team of security officers concerned with maintaining this lead.
FreeBSD is reliable. It is used by ISPs around the world. FreeBSD systems regularly go several years without rebooting. FreeBSD can fail, of course, but the main causes of outages are power failures and catastrophic hardware failures.
FreeBSD provides a complete TCP/IP networking implementation. This means that your FreeBSD machine can interoperate easily with other systems and also act as an enterprise server, providing vital functions such as NFS (remote file access) and electronic mail services, or putting your organization on the Internet with WWW, FTP, routing and firewall services. In addition, the Ports Collection includes software for communicating with proprietary protocols.
Memory protection ensures that neither applications nor users can interfere with each other. If an application crashes, it cannot affect other running applications.
FreeBSD includes the XFree86 implementation of theX11 graphical user interface.
FreeBSD can run most programs built for versions of SCO UNIX and UnixWare, Solaris, BSD/OS, NetBSD, 386BSD and Linux on the same hardware platform.
The FreeBSD Ports Collection includes thousands of ready-to-run applications.
Thousands of additional and easy-to-port applications are available on the Internet. FreeBSD is source code compatible with most popular commercial UNIX systems and thus most applications require few, if any, changes to compile. Most freely available software was developed on BSD-like systems. As a result, FreeBSD is one of the easiest platforms you can port to.
Demand paged virtual memory (VM)and "merged VM/buffer cache" design efficiently satisfies applications with large appetites for memory while still maintaining interactive response to other users.
The base system contains a full complement of C, C++ and FORTRAN development tools. All commonly available programming languages, such as perl, python and ruby, are available. Many additional languages for advanced research and development are also available in the Ports Collection.
FreeBSD provides the complete source code for the entire system, so you have the greatest degree of control overyour environment. The licensing terms are the freest that you will find anywhere ("Hey, use it, don't pretend you wrote it, don't complain to us if you have problems"). Those are just the licensing conditions, of course. As we'll see later in the chapter, there are plenty of people prepared to help if you run into trouble.
Extensive online documentation, including traditional man pages and a hypertext-based online handbook.
FreeBSD is based on the 4.4BSD UNIX released by the Computer Systems Research Group (CSRG) at the University of California at Berkeley. The FreeBSD Project has spent many thousands of hours fine-tuning the system for maximum performance and reliability. FreeBSD's features, performance and reliability compare very favorably with those of commercial operating systems.
Since the source code is available, you can easily customize it for special applications or projects, in ways not generally possible with operating systems from commercial vendors. You can easily start out small with an inexpensive 386 class PC and upgrade as your needs grow. Here are a few of the applications in which people currently use FreeBSD:
Internet Services: the Internet grew up around Berkeley UNIX. The original TCP/IP implementation, released in 1982, was based on 4.2BSD, and nearly every current TCP/IP implementation has borrowed from it. FreeBSD is a descendent of this implementation, which has been maintained and polished for decades. It is the most mature and reliable TCP/IP available at any price. This makes it an ideal platform for a variety of Internet services such as FTP servers, World Wide Web servers, electronic mail servers, USENET news servers, DNS name servers and firewalls. With the Samba suite, you can replace a Microsoft file server.
Education: FreeBSD is an ideal way to learn about operating systems, computer architecture and networking. A number of freely available CAD, mathematical and graphic design packages also make it highly useful to those whose primary interest in a computer is to get other work done.
Research: FreeBSD is an excellent platform for research in operating systems as well as other branches of computer science, since the source code for the entire system is available. FreeBSD's free availability also makes it possible for remote groups to collaborate on ideas or shared development without having to worry about special licensing agreements or limitations on what may be discussed in open forums.
X Window workstation: FreeBSD makes an excellent choice for an inexpensive graphical desktop solution. UnlikeanXterminal, FreeBSD allows many applications to be run locally, if desired, thus relieving the burden on a central server. FreeBSD can even boot "diskless," making individual workstations even cheaper and easier to administer.
Software Development: The basic FreeBSD system comes with a full complement of development tools including the renowned GNU C/C++ compiler and debugger.
Licensing conditions
As the name suggests, FreeBSD is free. You don't have to pay for the code, you can use it on as many computers as you want, and you can give away copies to your friends. There are some restrictions, however. Here's the BSD license as used for all new FreeBSD code:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
This software is provided by the FreeBSD project "as is’ and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the FreeBSD project or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in anyway out of the use of this software, even if advised of the possibility of such damage.
The last paragraph is traditionally written in ALL CAPS, for reasons which don’t seem to have anything to do with the meaning. Older versions of the license also contained additional clauses relating to advertising.
A little history
FreeBSD is a labour of love: big commercial companies produce operating systems and charge lots of money for them; the FreeBSD project produces a professional-quality operating system and gives it away. That's not the only difference.
In 1981, when IBM introduced their Personal Computer, the microprocessor industry was still in its infancy. They entrusted Microsoft to supply the operating system. Microsoft already had their own version of UNIX, called XENIX, but the PC had a minimum of 16 kB and no disk. UNIX was not an appropriate match for this hardware. Microsoft went looking for something simpler. The "operating system "theychose was correspondingly primitive: 86/DOS, a clone of Digital Research’s successful CP/M operating system, written by Tim Paterson of Seattle Computer Products and originally called QDOS (Quick and Dirty Operating System). At the time, it seemed just the thing: it ran fine without a hard disk (in fact, the original PC didn't have a hard disk, not even as an option), and it didn't use up too much memory. The only thing that they really had to do was to change the name. IBM called its version PC-DOS, while Microsoft marketed its version under the name MS-DOS.
By this time, a little further down the US West Coast, the Computer Systems Research Group (CSRG) of the University of California at Berkeley had just modified ATT's UNIX operating system to run on the new DEC VAX 11/780 machine, which sported virtual memory, and had turned their attention to implementing some new protocols for the ARPANET: the so-called Internet Protocols.The version of UNIX that they had developed was now sufficiently different from ATT's system that it had been dubbed Berkeley UNIX.
As time went on, both MS-DOS and UNIX evolved. Before long, MS-DOS was modified to handle hard disks - not well, but it handled them, and for the PC users, it was so much better than what they had before that they ignored the inefficiencies. After all, the PC gave you your own hard disk on your desk, and you didn’t have to share it with all the other people in the department. Microsoft even tried to emulate the UNIX directory structure, but succeeded only in implementing the concept of nested directories. At Berkeley, they were developing a higher performance disk subsystem, the Fast File System, now known as the UNIX File System.
By the late 80s, it was evident that Microsoft no longer intended to substantially enhance MS-DOS. New processors with support for multitasking and virtual memory had replaced the old Intel 8088 processor of the IBM PC, but they still ran MS-DOS by emulating the 8088 processor, which was now completely obsolete. The 640 kB memory limit of the original PC, which once appeared bigger than anybody would ever need, became a serious problem. In addition, people wanted to do more than one thing at a time with their computers.
A solution to both problems was obvious: move to the 32 bit address mode of the new Intel 80386 processor and introduce real multitasking, which operating systems on larger machines had had for decades. Of course, these larger machines were only physically larger. The average PC of 1990 had more memory, more disk and more processing power than just about any of the large computers of the 70s. Nevertheless, Microsoft didn't solve these problems for its "Windows" platform until much later, and the solutions still leave a lot to be desired.
UNIX, on the other hand, was a relatively mature operating system at the time when the PC was introduced. As a result, Microsoft-based environments have had little influence on the development of UNIX. UNIX development was determined by other factors: changes in legal regulations in the USA between 1977 and 1984 enabled ATT first to license UNIX to other vendors, noticeably Microsoft, who announced XENIX in 1981, and then to market its own version of UNIX. ATT developed System III in 1982, and System V in 1983. The differences between XENIX and System V were initially small, but they grew: by the mid-80s, there were four different versions of UNIX: the Research Version, used almost only inside ATT, which from the eighth edition on derived from 4.1cBSD, the Berkeley Software Distribution (BSD) from Berkeley, the commercial System V from ATT, and XENIX, which no longer interested Microsoft, and was marketed by the company that had developed it, the Santa Cruz Operation, or SCO.
One casualty of UNIX’s maturity was the CSRG in Berkeley. UNIX was too mature to be considered an object of research, and the writing was on the wall: the CSRG would close down. Some people decided to port Berkeley UNIX to the PC—after all, SCO had ported its version of UNIX to the PC years earlier. In the Berkeley tradition, however, they wanted to give it away. The industry’s reaction was not friendly. In 1992, ATT's subsidiary USL (UNIX Systems Laboratories)!! led a lawsuit against Berkeley Software Design, Inc. (BSDI), the manufacturer of the BSD/386 operating system, later called BSD/OS, a system very similar to FreeBSD. They alleged distribution of ATT source code in violation of licence agreements. They subsequently extended the case to the University of California at Berkeley. The suit was settled out of court, and the exact conditions were not all disclosed. The only one that became public was that BSDI would migrate their source base to the newer 4.4BSD-Lite sources, a thing that they were preparing to do in any case. Although not involved in the litigation, it was suggested to FreeBSD that they should also move to 4.4 BSD-Lite, which was done with the release of FreeBSD release 2.0 in late 1994.
Now, in the early 21st century, FreeBSD is the best known of the BSD operating systems, one that many consider to follow in the tradition of the CSRG. I can think of no greater honour for the development team. It was developed on a shoestring budget, yet it manages to outperform commercial operating systems by an order of magnitude.
The end of the UNIX wars
In the course of the FreeBSD project, a number of things have changed about UNIX. Sun Microsystems moved from a BSD base to a System V base in the late 80s, a move that convinced many people that BSD was dead and that System V was the future. Things turned out differently: in 1992, ATT sold USL to Novell, Inc., who had introduced a product based on System V.4 called UnixWare. Although UnixWare has much better specifications than SCO's old System V3 UNIX, it was never success, and Novell finally sold their UNIX operation to SCO. SCO itself was then bought out by Caldera (which recently changed its name back to SCO), while the ownership of the UNIX trade mark has passed to the Open Group. System V UNIX is essentially dead: current commercial versions of UNIX have evolved so far since System V that they can't be considered the same system. By contrast, BSD is alive and healthy, and lives on in FreeBSD, NetBSD, OpenBSD and Apple's Mac OS X.
The importance of the ATT code in the earlier versions of FreeBSD was certainly overemphasized in the lawsuit. All of the disputed code was over 10 years old at the time, and none of it was of great importance. In January 2002, Caldera released all "ancient" versions of UNIX under a BSD license. These specifically included all versions of UNIX from which BSD was derived: the first to seventh editions of Research UNIX and 32V, the predecessor to 3BSD. As a result, all versions of BSD, including those over which the lawsuit was conducted, are now freely available.
Other free UNIX-like operating systems
FreeBSD isn't the only free UNIX-like operating system available—it's not even the best-known one. The best-known free UNIX-like operating system is undoubtedly Linux, but there are also a number of other BSD-derived operating systems. We'll look at them first:
386/BSD was the original free BSD operating system, introduced by William F. Jolitz in 1992. It never progressed beyond a test stage: instead, two derivative operating systems arose, FreeBSD and NetBSD. 386/BSD has been obsolete for years.
NetBSD is an operating system which, to the casual observer, is almost identical to FreeBSD. The main differences are that NetBSD concentrates on hardware independence, whereas FreeBSD concentrates on performance. FreeBSD also tries harder to be easy to understand for a beginner. You can find more information about NetBSD at http://www.NetBSD.org.
Apple computer introduced Version 10 (X) of its Mac OS in early 2001. It is a big deviation from previous versions of Mac OS: it is based on a Mach microkernel with a BSD environment. The base system (Darwin) is also free. FreeBSD and Darwin are compatible at the user source code level.
You could get the impression that there are lots of different, incompatible BSD versions. In fact, from a user viewpoint they're all very similar to each other, much more than the individual distributions of Linux, which we'll look at next.
FreeBSD and Linux
In 1991, Linux Torvalds, then a student in Helsinki, Finland, decided he wanted to run UNIX on his home computer. Atthat time the BSD sources were not freely available, and so Linus wrote his own version of UNIX, which he called Linux.
Linux is a superb example of how a few dedicated; clever people can produce an operating system that is better than well-known commercial systems developed by a large number of trained software engineers. It is better even than a number of commercial UNIX systems.
Obviously, I prefer FreeBSD over Linux, or I wouldn't be writing this course , but the differences between FreeBSD and Linux are more a matter of philosophy rather than of concept. Here are a few contrasts:
Differences between FreeBSD and Linux
| FreeBSD is a direct descendent of the original UNIX, though it contains no residual AT T code | Linux is a clone and never contained any ATT code |
| FreeBSD is a complete operating system, maintained by a central group of software developers under the Concurrent Versions System which maintains a complete history of the project development. There is only one distribution of FreeBSD | Linux is a kernel, personally maintained by Linus Torvalds and a few trusted companions. The non-kernel programs supplied with Linux are part of a distribution, of which there are several. Distributions are not completely compatible with each other. |
| The FreeBSD development style emphasizes accountability and documentation of changes | The Linux kernel is maintained by a small number of people who keep track of all changes. Unofficial patches abound. |
| The kernel supplied with a specific release of FreeBSD is clearly defined. | Linux distributions often have subtly different kernels. The differences are not always documented |
| FreeBSD aims to be a stable production environment | Many versions of Linux are still "bleeding edge" development environments. This is changing rapidly, however |
| As a result of the centralized development style, FreeBSD is straightforward and easy to install | The ease of installation of Linux depends on the distribution. If you switch from one distribution of Linux to another, you’ll have to learn a new set of installation tools. |
| FreeBSD is still relatively unknown, since its distribution was initially restricted due to the ATT lawsuits | Linux did not have any lawsuits to contend with, so for some time it was thought to be the only free UNIX-type system available |
| As a result of the lack of knowledge of FreeBSD, relatively little commercial software is available for it | A growing amount of commercial software is becoming available for Linux. |
| As a result of the smaller user base, FreeBSD is less likely to have drivers for brand-new boards than Linux | Just about any new board will soon have a driver for Linux |
| Because of the lack of commercial applications and drivers for FreeBSD, Free-BSD runs most Linux programs, whether commercial or not | Linux appears not to need to be able to run FreeBSD programs |
| FreeBSD is licensed under the BSD license—see page 6. There are very few restrictions on its use. | Linux is licensed under the GNU General Public License. Further details are athttp://www.gnu.org/licenses/gpl.html.comparison with the BSD license, it imposes significant restrictions on what you can do with the source code. |
| FreeBSD Linux has aficionados who are prepared to pared to fame anybody who dares suggest fame anybody who dares suggest that it's that it's not better than Linux | In summary, Linux is also a very good operating system. For many, it's better than FreeBSD |
FreeBSD system documentation
FreeBSD comes with a considerable quantity of documentation which we'll look at in the following few pages:
The FreeBSD Documentation Project maintains a collection of "books," documents in HTML or PDF format which can also be accessed online. They're installed in the directory hierarchy /usr/share/doc.
The traditional UNIX document format is man pages, individual documents describing specific functionality. They’re short and to the point of being cryptic, but if you know what you're looking for, they have just the right amount of detail. They're not a good introduction.
The GNU project introduced their own document format, GNU info. Some GNU programs have no other form of documentation.
Reading online documentation
You'll find a number of HTML documents in the directory /usr/share/doc/en/books:
/usr/share/doc/en/books/faq/index.html contains the FreeBSD FAQ (Frequently Asked Questions). It's just what it says it is: a list of questions that people frequently ask about FreeBSD, with answers of course.
/usr/share/doc/en/books/fdp-primer/index.html is a primer for the FreeBSD Documentation Project,
/usr/share/doc/en/books/handbook/index.html is the FreeBSD online handbook. It contains a lot of information
specifically about FreeBSD, including a deeper discussion of many topics in this course .
/usr/share/doc/en/books/porters-handbook/index.html is a handbook for contributors to the FreeBSD Ports Collection, which we'll discuss in Chapter 9, The Ports Collection.
/usr/share/doc/en/books/ppp-primer/index.html contains a somewhat dated document about setting up PPP. If you have trouble with Chapter 20, Configuring PPP, you may find it useful.
In addition to the directory /usr/share/doc/en/books, there's also a directory /usr/share/doc/en/articles with a number of shorter items of documentation.
Note the component en in the pathnames above. That stands for English.A number of these books are also installed in other languages: change en to de for a German version, to es for Spanish, to fr for French, to ja for Japanese, to ru for Russian, or to zh for Chinese. Translation efforts are continuing, so you may find documentation in other languages as well.
If you're running X, you can use a browser like mozilla to read the documents. If you don’t have Running yet, use lynx. Both of these programs are included in the CD-ROM distribution. To install them, use sysinstall, which is described on page 92.
lynx is not a complete substitute for complete web browsers such as mozilla:since it is text-only, it is not capable of displaying the large majority of web pages correctly. It's good enough for reading most of the FreeBSD online documentation, however.
In each case, you start the browser with the name of the document, for example:
$ lynx /usr/share/doc/en/books/handbook/index.html
$ mozilla /usr/share/doc/en/books/handbook/index.html
Enter the after the invocation of mozilla to free up the window in which you invoke it: mozilla opens its own window.
If you haven’t installed the documentation, you can still access it from the Live File system CD-ROM. Assuming the CD-ROM is mounted on /cdrom, choose the file /cdrom/usr/share/doc/en/books/handbook/index.html.
Alternatively, you can print out the handbook. This is a little more difficult, and of course you'll lose the hypertext references, but you may prefer it in this form. To format the handbook for printing, you'll need a PostScript printer or ghostscript. See page 271 for more details of how to print PostScript.
The printable version of the documentation doesn't usually come with the CD-ROM distribution. You can pick it up with ftp
(see page 433) from ftp://ftp.FreeBSD.ORG/pub/FreeBSD/doc/,which has the same directory structure as described above. For example, you would download the handbook in PostScript form from ftp://ftp.FreeBSD.ORG/pub/FreeBSD/doc/en/books/handbook/book.ps.bz2.
The online manual
The most comprehensive documentation on FreeBSD is the online manual, usually referred to as the man pages. Nearly every program, file, library function, device or interface on the system comes with a short reference manual explaining the basic operation and various arguments. If you were to print it out, it would run to well over 8,000 pages.
When online, you view the man pages with the command man. For example, to learn more about the command ls, type:
$ man ls
LS(1) FreeBSD Reference Manual LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [-ACFLRTacdfiloqrstu1][file ... ]
DESCRIPTION
For each operand that names a file of a type other than directory, ls
displays its name as well as any requested, associated information. For
each operand that names a file of type directory, ls displays the names.
(etc)
In this particular example, with the exception of the first line, the text in constant width bold is not input, it's the way it appears on the screen.
The online manual is divided up into sections numbered:
User commands
System calls and error numbers
Functions in the C libraries
Device drivers
File formats
Games and other diversions
Miscellaneous information
System maintenance and operation commands
Kernel interface documentation
In some cases, the same topic may appear in more than one section of the online manual. For example, there is a user command chmod and a system call chmod(). In this case, you can tell the man command which you want by specifying the section number:
$ man 1 chmod
This command displays the manual page for the user command chmod. References to a particular section of the online manual are traditionally placed in parentheses in written documentation. For example, chmod(l) refers to the user command chmod, and chmod(2) means the systcode call.
This is fine if you know the name of the command and forgot how to use it, but what if you can't recall the command name? You can use man to search for keywords in the command descriptions by using the -k option, or by starting the program apropos:
$ man -k mail $
apropos mail
Both of these commands do the same thing: they show the names of the man pages that have the keyword mail in their descriptions.
Alternatively, you may browse through the /usr/bin directory, which contains most of the system executables. You'll see lots of file names, but you don't have any idea what they do. To find out, enter one of the lines:
$ cd /usr/bin; man -f *
$ cd /usr/bin; whatis *
Both of these commands do the same thing: they print out a one-line summary of the purpose of the program:
$ cd /usr/bin; man -f *
a2p(1) - Awk to Perl translator
addftinfo(l) - add information to troff font files for use with groff
apply(l) - apply a command to a set of arguments
apropos(1) - search the whatis database
...etc
Printing man pages
If you prefer to have man pages in print, rather than on the screen, you can do this in two different ways:
The simpler way is to redirect the output to the spooler:
$ man ls | lpr
This gives you a printed version that looks pretty much like the original on the screen, except that you may not get bold or underlined text.
You can get typeset output with troff:
$ man -t ls | lpr
This gives you a properly typeset version of the man page, but it requires that your spooling system understand PostScript—see page 271 for more
details of printing PostScript, even on printers that don't understand PostScript.
GNU info
The Free Software Foundation has its own online hypertext browser called info. Many FSF programs come with either no man page at all, or with an excuse for a man page (gcc, for example). To read the online documentation, you need to browse the info files with the info program, or from Emacs with the info mode. To start info,simply type:
$ info
In Emacs, enter CTRL-h i or ALT-x info. Whichever way you start info, you can get brief introduction by typing h, and a quick command reference by typing ?.
Other documentation on FreeBSD
FreeBSD users have access to probably more top-quality documentation than just about any other operating system. Remember that word UNIX is trademarked. Sure, the lawyers tell us that we can't refer to FreeBSD as UNIX, because UNIX belongs to the Open Group. That doesn't make the slightest difference to the fact that nearly every book on UNIX applies more directly to FreeBSD than any other flavour of UNIX. Why?
Commercial UNIX vendors have a problem, and FreeBSD doesn't help them: why should people buy their products when you can get it free from the FreeBSD Project (or, for that matter, from other free UNIX-like operating systems such as NetBSD, OpenBSD and Linux)? One obvious reason would be "value-added features." So they add features or fix weak points in the system, put a copyright on the changes, and help lock their customers in to their particular implementation. As long as the changes are really useful, this is legitimate, but it does make the operating system less compatible with "standard UNIX," and the books about standard UNIX are less applicable.
In addition, many books are written by people with an academic background. In the UNIX world, this means that they are more likely than the average user to have been exposed to BSD. Many general UNIX books handle primarily BSD, possibly with an additional chapter on the commercial System V version.
In Appendix A, Bibliography, you’ll find a list of books that I find worthwhile. I'd like to single out some that I find particularly good, and that I frequently use myself:
UNIX Power 7oo/s, by Jeny Peek, Tim O'Reilly, and Mike Loukides, is a superb collection of interesting information, including a CD-ROM. Recommended for everybody, from beginners to experts.
UNIX for the Impatient ,by Paul W. Abrahams and Bruce R. Larson, is more similar to this book, but it includes a lot more material on specific products, such as shells and the Emacs editor.
The UNIX System Administration Handbook, by Evi Nemeth, Garth Snyder, Scott Seebass, and Trent R. Hein, is one of the best books on systems administration I have seen. It covers a number different UNIX systems, including an older version of FreeBSD.
There are also many active Internet groups that deal with FreeBSD. Read about them in the online handbook.
The FreeBSD community
FreeBSD was developed by a world-wide group of developers. It could not have happened without the Internet. Many of the key players have never even met each other in person; the main means of communication is via the Internet. If you have any kind of Internet connection, you can participate as well. If you don't have an Internet connection, it's about time you got one. The connection doesn't have to be complete: if you can receive email, you can participate. On the other hand, FreeBSD includes all the software you need for a complete Internet connection, not the very limited subset that most PC-based "Internet" packages offer you.
Mailing lists
As it says in the copyright, FreeBSD is supplied as-is, without any support liability. If you're on the Internet, you're not alone, however. Liability is one thing, but there are plenty of people prepared to help you, most for free, some for fee. A good place to start is with the mailing lists. There are a number of mailing lists that you can join. Some of the more interesting ones are:
FreeBSD-questions@FreeBSD.org is the list to which you may send general questions, in particular on how to use FreeBSD. If you have difficulty understanding anything in this course , for example, this is the right place to ask. It's also the list to use if you're not sure which is the most appropriate.
FreeBSD-questions@FreeBSD.org is a list for newcomers to FreeBSD. It's intended for people who feel a little daunted by the system and need a bit of reassurance. It's not the right place to ask any kind of technical question.
FreeBSD-questions@FreeBSD.org is a technical discussion list.
FreeBSD-questions@FreeBSD.org is an obligatory list for people who run the development version of FreeBSD, called FreeBSD-CURRENT.
FreeBSD-questions@FreeBSD.org is a similar list for people who run the more recent stable version of FreeBSD, called FreeBSD-STABLE. We'll talk about these versions on page 582. Unlike the case for FreeBSD-CURRENT users, it's not obligatory for
FreeBSD-STABLE users to subscribe to FreeBSD-stable.
You can find a complete list of FreeBSD mailing lists on the web site, currently at
http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/eresources.html. This address is part of the online handbook and may change when the handbook is modified; follow the link if it is no longer valid, or if you can't be bothered typing in the URI.
The mailing lists are run by mailman (in the Ports Collection). Join them via the web interface mentioned above. You will receive a mail message from mailman asking you to confirm your subscription by replying to the message. You don't need to put anything in the reply: the reply address is used once only, and you're the only person who will ever see it, so the system knows that it's you by the fact that you replied at all. You also have the option of confirming via a web interface with a specially generated URI. Similar considerations apply in this case.
FreeBSD mailing lists can have a very high volume of traffic. The FreeBSD-questions mailing list, for example, has thousands of subscribers, and many of them are themselves mailing lists. It receives over a hundred messages every day. That's about a million messages a day in total for just one mailing list, so when you sign up for a mailing list, be sure to read the charter. You can find the URI from the mailman confirmation message. It's also a good idea to "lurk" (listen, but not say anything) on the mailing list a while before posting anything: each list has its own traditions.
When submitting a question to FreeBSD-questions, consider the following points:
Remember that nobody gets paid for answering a FreeBSD question. They do it of their own free will. You can influence this free will positively by submitting a well-formulated question supplying as much relevant information as possible. You can influence this free will negatively by submitting an incomplete, illegible, or rude question. It's perfectly possible to send a message to FreeBSD-questions and not get an answer even if you follow these rules. It's much more possible to not get an answer if you don't.
Not everybody who answers FreeBSD questions reads every message: they look at the subject line and decide whether it interests them. Clearly, it's in your interest to specify a subject. "FreeBSD problem" or "Help" aren't enough. If you provide no subject at all, many people won’t bother reading it. If your subject isn'tspecific enough, the people who can answer it may not read it.
When sending a new message, well, send a new message. Don't just reply to some other message, erase the old content and change the subject line. That leaves an In-Reply-To: header which many mail readers use to thread messages, so your message shows up as a reply to some other message. People often delete messages a whole thread at a time, so apart from irritating people, you also run a chance of having the message deleted unread.
Format your message so that it is legible, and PLEASE DON'T SHOUT!!!!!. It's really painful to try to read a message written full of typos or without any line breaks. Alot of badly formatted messages come from bad mailers or badly configured mailers. The following mailers are known to send out badly formatted messages without you finding out about them:
Eudora
Exmh
Microsoft Exchange
Microsoft Internet Mail
Microsoft Outlook
Netscape
As you can see, the mailers in the Microsoft world are frequent offenders. If at all possible, use a UNIX mailer. If you must use a mailer under Microsoft environments, make sure it is set up correctly. Try not to use MIME: a lot of people use mailers which don't get on very well with MIME.
For further information on this subject, check out http://www.lemis.com/email.html.
Make sure your time and time zone are set correctly. This may seem a little silly, since your message still gets there, but many of the people you are trying to reach get several hundred messages a day.Theyfrequently sort the incoming messages by subject and by date, and if your message doesn't come before the first answer, they may assume they missed it and not bother to look.
Don’t include unrelated questions in the same message. Firstly, along message tends to scare people off, and secondly, it's more difficult to get all the people who can answer all the questions to read the message.
Specify as much information as possible. This is a difficult area: the information you need to submit depends on the problem. Here’s start:
If you get error messages, don't say "I get error messages", say (for example) "I get the error message
No route to host".
If your system panics, don'tsay "My system panicked", say (for example) "my system panicked with the message free vnode isn't".
If you have difficulty installing FreeBSD, please tell us what hardware you have, particularly if you have something unusual.
If, for example, you have difficulty getting PPP to run, describe the configuration. Which version of PPP do you use? What kind of authentication do you have? Do you have a static or dynamic IP address? What kind of messages do you get in the log file? See Chapter 20, Configuring PPP, for more details in this particular case.
If you don't get an answer immediately, or if you don't even see your own message appear on the list immediately, don't resend the message. Wait at least 24 hours. The FreeBSD mailer offloads messages to a number of subordinate mailers around the world. Usually the messages come through in a matter of seconds, but sometimes it can take several hours for the mail to get through.
If you do all this, and you still don't get an answer, there could be other reasons. For example, the problem is so complicated that nobody knows the answer, or the person who does know the answer was offine. If you don't get an answer after, say, a week, it might help to re-send the message. If you don't get an answer to your second message, though, you're probably not going to get one from this forum. Resending the same message again and again will only make you unpopular.
How to follow up to a question
Often you will want to send in additional information to a question you have already sent. The best way to do this is to reply to your original message. This has three advantages:
You include the original message text, so people will know what you're talking about. Don't forget to trim unnecessary text, though.
The text in the subject line stays the same (you did remember to put one in, didn't you?). Many mailers will sort messages by subject. This helps group messages together.
The message reference numbers in the header will refer to the previous message. Some mailers, such as mutt, can thread messages, showing the exact relationships between the messages.
There are more suggestions, in particular for answering questions, at http://www.lemis.com/questions.html. See also Chapter 26, and the support page at http://www. FreeBSD.org/support.html.
In addition, a number of companies offer support for FreeBSD. See the web page http://www.FreeBSD.org/commercial/consulting_bycat.html for some possibilities.
Unsubscribing from the mailing lists
There's a lot of traffic on the mailing lists, particularly on FreeBSD-questions. You may find you can't take it and want to get out again. Again, you unsubscribe from the list either via the web or via a special mail address, not by sending mail to the the list. Each message you get from the mailing lists finishes with the following text:
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
Don't be one of those people who send the unsubscribe request to the mailing list instead.
User groups
But how about meeting FreeBSD users face to face? There are a number of user groups around the world. If you live in a big city, chances are that there's one near you. Check http://www.FreeBSD.org/support.html#user for a list. If you don't find one, consider taking the initiative and starting one.
In addition, USENIX holds an annual conference, the for more details.
Reporting bugs
If you find something wrong with FreeBSD, we want to know about it, so that we can fix it. To report a bug, use the send-pr program to send it as a mail message.
There used to be a web form at http://www.FreeBSD.org/send-pr.html, but it has been closed down due to abuse.
The Berkeley daemon
The little daemon at the right symbolizes BSD. It is included with kind permission of Marshall Kirk McKusick, one of the leading members of the former Computer Sciences Research Group at the University of California at Berkeley, and owner of the daemon's copyright. Kirk also wrote the foreword to this course .
(рис 1.1)
The daemon has occasionally given rise to a certain amount of confusion. In fact, it's a joking reference to processes that run in the background—see Chapter 8, Taking control, page 150, for a description. The outside world occasionally sees things differently, as the following story indicates:
Newsgroups: alt.humor.best-of-usenet
Subject: [comp.org.usenix] A Great Daemon Story
From: Rob Kolstad <kolstad@bsdi.com>
Newsgroups: comp.org.usenix
Subject: A Great Daemon Story
Linda Branagan is an expert on daemons. She has a T-shirt that sports the daemon in tennis shoes that appears on the cover of the 4.3BSD manuals and The Design and Implementation of the 4.3BSD UNIX Operating System by S. Leffler, M. McKusick, M. Karels, J. Quarterman, Addison Wesley Publishing Company, Reading, MA 1989.
She tells the following story about wearing the 4.3BSD daemon T-shirt:
Last week I walked into a local "home style cookin' restaurant/watering hole" in Texas to pick up a take-out order. I spoke briefly to the waitress behind the counter, who told me my order would be done in a few minutes.
So, while I was busy gazing at the farm implements hanging on the walls, I was approached by two "natives." These guys might just be the original Texas rednecks.
"Pardon us, ma'am. Mind if we ask you a question?"
Well, people keep telling me that Texans are real friendly, so I nodded.
"Are you a Satanist?"
Well, at least they didn't ask me if I liked to party.
"Uh, no, I can't say that I am."
"Gee, ma'am. Are you sure about that?" they asked.
I put on my biggest, brightest Dallas Cowboys cheerleader smile and said, "No, I'm positive. The closest I've ever come to Satanism is watching Geraldo."
"Hmmm. Interesting. See, we was just wondering why It is you have the lord of darkness on your chest there."
I was this close to slapping one of them and causing a scene—then I stopped and noticed the shirt I happened to be wearing that day. Sure enough, it had a picture of a small, devilish-looking creature that has for some time now been associated with a certain operating system. In this particular representation, the creature was wearing sneakers.
They continued: "See, ma'am, we don'texactly appreciate it when people showoff pictures of the devil. Especially when he'slookin' so friendly."
These idiots sounded terrifyingly serious.
Me: "Oh, well, see, this isn't really the devil, it's just, well, it's sort of a mascot.
Native: "And what kind of football team has the devil as a mascot?"
Me: "Oh, it's not a team. It's an operating—uh, a kind of computer."
I figured that an ATM machine was about as much technology as these guys could handle, and I knew that if I so much as uttered the word "UNIX" I would only make things worse.
Native: "Where does this satanical computer come from?"
Me: "California. And there's nothing satanical about it really."
Somewhere along the line here, the waitress noticed my predicament—but these guys probably outweighed her by 600 pounds, so all she did was look at me sympathetically and run off into the kitchen.
Native: "Ma'am, I think you're lying. And we'd appreciate it if you'd leave the premises now."
Fortunately, the waitress returned that very instant with my order, and they agreed that it would be okay for me to actually pay for my food before I left. While I was at the cash register, they am used themselves by talking to each other.
Native #1: "Do you think the police know about these devil computers?"
Native #2: "If they come from California, then the FBI oughta know about 'em."
Theye scorted me to the door. I tried one last time: "You're really blowing this all out of proportion. Alot of people use this 'kind of computers.' Universities, researchers, businesses. They're actually very useful."
Big, big, big mistake. I should have guessed at what came next.
Native:"Does the government use these devil computers?"
Me: "Yes."
Another big boo-boo.
Native:"And does the government pay for 'em? With our tax dollars?"
Idecided that it was time to jump ship.
Me: "No. Nope. Not at all. Your tax dollars never entered the picture at all. I promise. No sir, not a penny. Our good Christian congressmen would never let something like that happen. Nope. Never. Bye."
Texas. What acountry.
The daemon tradition goes back quite a way. Asrecently as 1996, after the publication of the first edition of this book, the following message went through the FreeBSD-chat mailing list:
To: "Jonathan M. Bresler" <jmb@freefall.freebsd.org>
Cc: obrien@antares.aero.org (Mike O'Brien),
joerg_wunsch@uriah.heep.sax.de,
chat@FreeBSD.org, juphoff@tarsier.cv.nrao.edu
Date: Tue, 07 May 1996 16:27:20 -0700
Sender: owner-chat@FreeBSD.org
>details and gifs PLEASE!
If you insist. :-)
Sherman, set the Wayback Machine for around 1976 or so (see Peter Salus' A
Quarter Century of UNIX for details), when the first really national UNIX
meeting was held in Urbana, Illinois. This would be after the "forty people
in a Brooklyn classroom" meeting held by Mel Ferentz (yeah I was at that too)
and the more-or-less simultaneous West Coast meeting(s) hosted by SRI, but before
the UNIX Users Group was really incorporated as a going concern.
I knew Ken Thompson and Dennis Ritchie would be there. I was living in Chicago
at the time, and so was comic artist Phil Foglio, whose star was just beginning
to rise. At that time I was a bonded locksmith. Phil's roommate had unexpectedly
split town, and he was the only one who knew the combination to the wall safe in
their apartment. This is the only apartment I've ever seen that had a wall safe,
but it sure did have one, and Phil had some stuff locked in there. I didn't hold
out much hope, since safes are far beyond where I was (and am) in my locks mithing
sphere of competence, but I figured "no guts no glory" and told him I'd
give it a whack. In return, I told him, he could do some T-shirt art for me. He readily agreed.
Wonder of wonders, this safe was vulnerable to the same algorithm that Master
locks used to be susceptible to. I opened it in about 15 minutes of manipulation.
It was my greatest moment as a locksmith and Phil was overjoyed. I went down to my
lab and shot some Polaroid snaps of the PDP-11 system I was running UNIX on at the
time, and gave it to Phil with some descriptions of the visual puns I wanted: pipes,
demons with forks running along the pipes, a "bit bucket" named /dev/null, all that.
What Phil came up with is the artwork that graced the first decade's worth of
"UNIX T-shirts," which were made by a Ma and Paoperation in a Chicago
suburb. They turned out transfer art using a 3M color copier in their basement.
Hence, the PDP-11 is reversed (the tape drives are backwards) but since Phil left off
the front panel, this was hard to tell. His trademark signature was photo-reversed,
but was recopied by the T-shirt people and "re-forwardized," which is why
it looks a little funny compared to his real signature.
Dozens and dozens of these shirts were produced. Bell Labs alone accounted for
an order of something like 200 for a big picnic. However, only four (4) REAL
originals were produced: these have a distinctive red collar and sleeve cuff.
One went to Ken, one to Dennis, one to me, and one to my then-wife. I now possess
the latter two shirts. Ken and Dennis were presented with their shirts at the Urbana conference.
People ordered these shirts direct from the Chicago couple. Many years later,
when I was living in LA, I got a call from Armando Stettner, then at DEC,
asking about that now-famous artwork. I told him I hadn't talked to the Illinois
T-shirt makers in years. At his request I called them up. They'd folded the operation
years ago and were within days of discarding all the old artwork. I requested its return,
and duly received It back in the mail. It looked strange, seeing it again in its
original form, a mirror image of the shirts with which I and everyone else were now familiar.
I sent the artwork to Armando, who wanted to give it to the Ultrix marketing people.
They came out with the Ultrix poster that showed a nice shiny Ultrix machine
contrasted with the chewing-gum-and-string PDP-11 UNIX people were familiar with.
They still have the artwork, so far as I know.
I no longer recall the exact contents of the letter I sent along with the artwork.
I did say that as far as I knew, Phil had no residual rights to the art,
since it was a 'work made for hire', though nothing was in writing
(and note this was decades before the new copyright law). I do not now recall
if I explicitly assigned all rights to DEC. What is certain is that John Lassiter's daemon,
whether knowingly borrowed from the original, or created by parallel evolution,
postdates the first horde of UNIX daemons by at least a decade and probably more.
And if Lassiter's daemon looks a lot like a Phil Foglio creation, there's are a son.
I have never scanned in Phil's artwork; I've hardly ever scanned in anything,
so I have no GIFs to show. But I have some very very old UNIX T-shirts in
startlingly good condition. Better condition than I am at any rate:
I no longer fit into either of them.
Mike O'Brien
Creaky antique
Note the date of this message: it appeared since the first edition of this book. Since then, the daemon image has been scanned in, and you can find a version at http://www. mckusick.com/beastie/shirts/usenix.html
Introduction
FreeBSD is a free operating system derived from ATT's UNIX operating system FreeBSD no longer contains anyATT proprietary code, so it may be distributed freely. See page 7 for more details. It runs on the following platforms:
Computers based on the Intel i386 CPU architecture, including the 386, 486 and Pentium families of processors, and compatible CPUs from AMD and Cyrix.
The Compaq/Digital Alpha processor.
64 bit SPARC machines from Sun Microsystems.
In addition, significant development efforts are going towards porting FreeBSD to other hardware, notably the Intel 64 bit architecture and the IBM/Motorola PowerPC architecture.
This course describes the released versions of FreeBSD for Intel and Alpha processors. Current support for SPARC 64 processors is changing too fast for it to be practical to give details specific to this processor, but nearly everything in this course also applies to SPARC 64.
How to use this course
This course is intended for a number of different audiences. It attempts to present the material without too many forward references. It contains the following parts:
The first part, Chapters 1 to 6, tells you howtoinstall FreeBSD and what to do if things go wrong.
Chapters 7to15introduce you to life with FreeBSD, including setting up optional features and system administration.
Chapters 16 to 27 introduce you to FreeBSD's rich network support.
Finally, Chapters 28 to 33 look at system administration topics that build on all the preceding material.
In more detail, we'll discuss the following subjects:
In the rest of this chapter, we’ll look at what FreeBSD is, what you need to run it, and what resources are available, including FreeBSD's features and history, how it compares to other free UNIX-like operating systems, other sources of information about FreeBSD, the world-wide FreeBSD community, and support for FreeBSD. In addition, we'll look at the BSD'sdaemon emblem.
Chapter 2, Before you install, discusses the installation requirements and theoretical background of installing FreeBSD.
Chapter 3, Quick installation, presents a quick overview of the installation process. If you're reasonably experienced, this may be all you need to install FreeBSD.
In Chapter 4, Shared OS installation,we'll look at preparing to install FreeBSD on a system that already contains another operating system.
In Chapter 5, Installing FreeBSD,we'll walk through a typical installation in detail.
Chapter 6, Post-installation configuration,explains the configuration you need to do after installation to get a complete functional system.
Chapter 7, The tools of the trade, presents a number of aspects of FreeBSD that are of interest to newcomers (particularly from a Microsoft environment). We'll look at setting up a desktop, the concept of users and file naming. We’ll also consider the basics of using the shell and editor, and how to shut down the machine.
Chapter 8, Taking control, goes into more detail about the specifics of working with UNIX, such as processes, daemons, timekeeping and log files. We’ll also look at features unique to FreeBSD, including multiple processor support, removable I/O devices and emulating other systems.
Chapter 9, The Ports Collection,describes the thousands of free software packages that you can optionally install on a FreeBSD system.
Chapter 10, File systems and devices, contains information about the FreeBSD directory structure and device names. You'll find the section on device names (starting on page 195) interesting even if you're an experienced UNIX hacker.
Chapter 11, Disks, describes how to format and integrate hard disks, and how to handle disk errors.
Managing disks can be a complicated affair. Chapter 12, The Vinum Volume Manager, describes a way of managing disk storage.
In Chapter 13, Writing CD-Rs, we'll look at how to use FreeBSD to write CD-Rs.
FreeBSD provides professional, reliable data backup services as part of the base system. Don't ever let yourself lose data because of inadequate backup provisions. Read all about it in Chapter 14, Tapes, backups and floppy disks.
Chapter 15, Printers, describes the BSD spooling system and how to use it both on local and networked systems.
Starting at Chapter 16, Networks and the Internet, we’ll look at the Internet and the more important services.
Chapter 17, Configuring the local network, describes how to set up local networking.
Chapter 18, Connecting to the Internet, discusses the issues in selecting an Internet Service Provider (ISP) and establishing a presence on the Internet.
Chapter 19, Serial communications, discusses serial hardware and the prerequisites for PPP and SLIP communications.
In Chapter 20, Configuring PPP,we'll look at FreeBSD's two PPP implementations and what it takes to set them up.
In Chapter 21, The Domain Name Service, we'll consider the use of names on the Internet.
Security is an increasing problem on the Internet. In Chapter 22, Fire walls, IP aliasing and proxies,we'll look at some things we can do to improve it. We'll also look at IP aliasing, since it goes hand-in-hand with firewalls, and proxy servers.
Networks sometimes become not works. In Chapter 23, Network debugging, we’ll see what we can do to solve net work problems.
Chapter 24, Basic network access: clients,describes the client viewpoint of network access, including Web browsers, ssh, ftp, rsync and nfs clients for sharing file systems between networked computers.
Network clients talk to network servers. We'll look at the corresponding server viewpoint in Chapter 25, Basic network access: servers.
Despite the World Wide Web, traditional two-way personal communication is still very popular. We'll look at how to use mail clients in Chapter 26, Electronic mail: clients.
Mail servers are an important enough topic that there's a separate Chapter 27, Electronic mail: servers.
In Chapter 28, XFree86 in depth, we'll look at the theory behind getting X11 working.
Chapter 29, Starting and stopping the system, describes how to start and stop a FreeBSD system and all the things you can do to customize it.
In Chapter 30, FreeBSD configuration files, we'll look at the more common configuration files and what they should contain.
In Chapter 31, Keeping up to date, we’ll discuss howtoensure that your system is always running the most appropriate version of FreeBSD.
FreeBSD keeps changing. We'll look at some aspects of what that means to you in Chapter 32, Updating the system software.
Chapter 33, Custom kernels, discusses optional kernel features.
Appendix A, Bibliography,suggests some books for further reading.
Appendix B, The evolution of FreeBSD, describes the changes that have taken place in FreeBSD since it was introduced nearly ten years ago.
FreeBSD features
FreeBSD is derived from Berkeley UNIX,the flavour of UNIX developed by the Computer Systems Research Group at the University of California at Berkeley and previously released as the Berkeley Software Distribution (BSD) of UNIX.
UNIX is a registered trademark of the Open Group, so legally; FreeBSD may not be called UNIX. The technical issues are different, of course; makeup your own mind as to how much difference this makes.
Like commercial UNIX, FreeBSD provides you with many advanced features, including:
FreeBSD uses preemptive multitasking with dynamic priority adjustment to ensure smooth and fair sharing of the computer between applications and users.
FreeBSD is a multi-user system:many people can use a FreeBSD system simultaneously for unrelated purposes. The system shares peripherals such as printers and tape drives properly between all users on the system.
Don't get this confused with the multitasking offered by some commercial systems. FreeBSD is a true multi-user system that protects users from each other.
FreeBSD is secure. Its track record is borne out by the reports of the CERT,the leading organization dealing with computer security. See http://www.cert.org for more information. The FreeBSD project has a team of security officers concerned with maintaining this lead.
FreeBSD is reliable. It is used by ISPs around the world. FreeBSD systems regularly go several years without rebooting. FreeBSD can fail, of course, but the main causes of outages are power failures and catastrophic hardware failures.
FreeBSD provides a complete TCP/IP networking implementation. This means that your FreeBSD machine can interoperate easily with other systems and also act as an enterprise server, providing vital functions such as NFS (remote file access) and electronic mail services, or putting your organization on the Internet with WWW, FTP, routing and firewall services. In addition, the Ports Collection includes software for communicating with proprietary protocols.
Memory protection ensures that neither applications nor users can interfere with each other. If an application crashes, it cannot affect other running applications.
FreeBSD includes the XFree86 implementation of theX11 graphical user interface.
FreeBSD can run most programs built for versions of SCO UNIX and UnixWare, Solaris, BSD/OS, NetBSD, 386BSD and Linux on the same hardware platform.
The FreeBSD Ports Collection includes thousands of ready-to-run applications.
Thousands of additional and easy-to-port applications are available on the Internet. FreeBSD is source code compatible with most popular commercial UNIX systems and thus most applications require few, if any, changes to compile. Most freely available software was developed on BSD-like systems. As a result, FreeBSD is one of the easiest platforms you can port to.
Demand paged virtual memory (VM)and "merged VM/buffer cache" design efficiently satisfies applications with large appetites for memory while still maintaining interactive response to other users.
The base system contains a full complement of C, C++ and FORTRAN development tools. All commonly available programming languages, such as perl, python and ruby, are available. Many additional languages for advanced research and development are also available in the Ports Collection.
FreeBSD provides the complete source code for the entire system, so you have the greatest degree of control overyour environment. The licensing terms are the freest that you will find anywhere ("Hey, use it, don't pretend you wrote it, don't complain to us if you have problems"). Those are just the licensing conditions, of course. As we'll see later in the chapter, there are plenty of people prepared to help if you run into trouble.
Extensive online documentation, including traditional man pages and a hypertext-based online handbook.
FreeBSD is based on the 4.4BSD UNIX released by the Computer Systems Research Group (CSRG) at the University of California at Berkeley. The FreeBSD Project has spent many thousands of hours fine-tuning the system for maximum performance and reliability. FreeBSD's features, performance and reliability compare very favorably with those of commercial operating systems.
Since the source code is available, you can easily customize it for special applications or projects, in ways not generally possible with operating systems from commercial vendors. You can easily start out small with an inexpensive 386 class PC and upgrade as your needs grow. Here are a few of the applications in which people currently use FreeBSD:
Internet Services: the Internet grew up around Berkeley UNIX. The original TCP/IP implementation, released in 1982, was based on 4.2BSD, and nearly every current TCP/IP implementation has borrowed from it. FreeBSD is a descendent of this implementation, which has been maintained and polished for decades. It is the most mature and reliable TCP/IP available at any price. This makes it an ideal platform for a variety of Internet services such as FTP servers, World Wide Web servers, electronic mail servers, USENET news servers, DNS name servers and firewalls. With the Samba suite, you can replace a Microsoft file server.
Education: FreeBSD is an ideal way to learn about operating systems, computer architecture and networking. A number of freely available CAD, mathematical and graphic design packages also make it highly useful to those whose primary interest in a computer is to get other work done.
Research: FreeBSD is an excellent platform for research in operating systems as well as other branches of computer science, since the source code for the entire system is available. FreeBSD's free availability also makes it possible for remote groups to collaborate on ideas or shared development without having to worry about special licensing agreements or limitations on what may be discussed in open forums.
X Window workstation: FreeBSD makes an excellent choice for an inexpensive graphical desktop solution. UnlikeanXterminal, FreeBSD allows many applications to be run locally, if desired, thus relieving the burden on a central server. FreeBSD can even boot "diskless," making individual workstations even cheaper and easier to administer.
Software Development: The basic FreeBSD system comes with a full complement of development tools including the renowned GNU C/C++ compiler and debugger.
Licensing conditions
As the name suggests, FreeBSD is free. You don't have to pay for the code, you can use it on as many computers as you want, and you can give away copies to your friends. There are some restrictions, however. Here's the BSD license as used for all new FreeBSD code:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
This software is provided by the FreeBSD project "as is’ and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the FreeBSD project or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in anyway out of the use of this software, even if advised of the possibility of such damage.
The last paragraph is traditionally written in ALL CAPS, for reasons which don’t seem to have anything to do with the meaning. Older versions of the license also contained additional clauses relating to advertising.
A little history
FreeBSD is a labour of love: big commercial companies produce operating systems and charge lots of money for them; the FreeBSD project produces a professional-quality operating system and gives it away. That's not the only difference.
In 1981, when IBM introduced their Personal Computer, the microprocessor industry was still in its infancy. They entrusted Microsoft to supply the operating system. Microsoft already had their own version of UNIX, called XENIX, but the PC had a minimum of 16 kB and no disk. UNIX was not an appropriate match for this hardware. Microsoft went looking for something simpler. The "operating system "theychose was correspondingly primitive: 86/DOS, a clone of Digital Research’s successful CP/M operating system, written by Tim Paterson of Seattle Computer Products and originally called QDOS (Quick and Dirty Operating System). At the time, it seemed just the thing: it ran fine without a hard disk (in fact, the original PC didn't have a hard disk, not even as an option), and it didn't use up too much memory. The only thing that they really had to do was to change the name. IBM called its version PC-DOS, while Microsoft marketed its version under the name MS-DOS.
By this time, a little further down the US West Coast, the Computer Systems Research Group (CSRG) of the University of California at Berkeley had just modified ATT's UNIX operating system to run on the new DEC VAX 11/780 machine, which sported virtual memory, and had turned their attention to implementing some new protocols for the ARPANET: the so-called Internet Protocols.The version of UNIX that they had developed was now sufficiently different from ATT's system that it had been dubbed Berkeley UNIX.
As time went on, both MS-DOS and UNIX evolved. Before long, MS-DOS was modified to handle hard disks - not well, but it handled them, and for the PC users, it was so much better than what they had before that they ignored the inefficiencies. After all, the PC gave you your own hard disk on your desk, and you didn’t have to share it with all the other people in the department. Microsoft even tried to emulate the UNIX directory structure, but succeeded only in implementing the concept of nested directories. At Berkeley, they were developing a higher performance disk subsystem, the Fast File System, now known as the UNIX File System.
By the late 80s, it was evident that Microsoft no longer intended to substantially enhance MS-DOS. New processors with support for multitasking and virtual memory had replaced the old Intel 8088 processor of the IBM PC, but they still ran MS-DOS by emulating the 8088 processor, which was now completely obsolete. The 640 kB memory limit of the original PC, which once appeared bigger than anybody would ever need, became a serious problem. In addition, people wanted to do more than one thing at a time with their computers.
A solution to both problems was obvious: move to the 32 bit address mode of the new Intel 80386 processor and introduce real multitasking, which operating systems on larger machines had had for decades. Of course, these larger machines were only physically larger. The average PC of 1990 had more memory, more disk and more processing power than just about any of the large computers of the 70s. Nevertheless, Microsoft didn't solve these problems for its "Windows" platform until much later, and the solutions still leave a lot to be desired.
UNIX, on the other hand, was a relatively mature operating system at the time when the PC was introduced. As a result, Microsoft-based environments have had little influence on the development of UNIX. UNIX development was determined by other factors: changes in legal regulations in the USA between 1977 and 1984 enabled ATT first to license UNIX to other vendors, noticeably Microsoft, who announced XENIX in 1981, and then to market its own version of UNIX. ATT developed System III in 1982, and System V in 1983. The differences between XENIX and System V were initially small, but they grew: by the mid-80s, there were four different versions of UNIX: the Research Version, used almost only inside ATT, which from the eighth edition on derived from 4.1cBSD, the Berkeley Software Distribution (BSD) from Berkeley, the commercial System V from ATT, and XENIX, which no longer interested Microsoft, and was marketed by the company that had developed it, the Santa Cruz Operation, or SCO.
One casualty of UNIX’s maturity was the CSRG in Berkeley. UNIX was too mature to be considered an object of research, and the writing was on the wall: the CSRG would close down. Some people decided to port Berkeley UNIX to the PC—after all, SCO had ported its version of UNIX to the PC years earlier. In the Berkeley tradition, however, they wanted to give it away. The industry’s reaction was not friendly. In 1992, ATT's subsidiary USL (UNIX Systems Laboratories)!! led a lawsuit against Berkeley Software Design, Inc. (BSDI), the manufacturer of the BSD/386 operating system, later called BSD/OS, a system very similar to FreeBSD. They alleged distribution of ATT source code in violation of licence agreements. They subsequently extended the case to the University of California at Berkeley. The suit was settled out of court, and the exact conditions were not all disclosed. The only one that became public was that BSDI would migrate their source base to the newer 4.4BSD-Lite sources, a thing that they were preparing to do in any case. Although not involved in the litigation, it was suggested to FreeBSD that they should also move to 4.4 BSD-Lite, which was done with the release of FreeBSD release 2.0 in late 1994.
Now, in the early 21st century, FreeBSD is the best known of the BSD operating systems, one that many consider to follow in the tradition of the CSRG. I can think of no greater honour for the development team. It was developed on a shoestring budget, yet it manages to outperform commercial operating systems by an order of magnitude.
The end of the UNIX wars
In the course of the FreeBSD project, a number of things have changed about UNIX. Sun Microsystems moved from a BSD base to a System V base in the late 80s, a move that convinced many people that BSD was dead and that System V was the future. Things turned out differently: in 1992, ATT sold USL to Novell, Inc., who had introduced a product based on System V.4 called UnixWare. Although UnixWare has much better specifications than SCO's old System V3 UNIX, it was never success, and Novell finally sold their UNIX operation to SCO. SCO itself was then bought out by Caldera (which recently changed its name back to SCO), while the ownership of the UNIX trade mark has passed to the Open Group. System V UNIX is essentially dead: current commercial versions of UNIX have evolved so far since System V that they can't be considered the same system. By contrast, BSD is alive and healthy, and lives on in FreeBSD, NetBSD, OpenBSD and Apple's Mac OS X.
The importance of the ATT code in the earlier versions of FreeBSD was certainly overemphasized in the lawsuit. All of the disputed code was over 10 years old at the time, and none of it was of great importance. In January 2002, Caldera released all "ancient" versions of UNIX under a BSD license. These specifically included all versions of UNIX from which BSD was derived: the first to seventh editions of Research UNIX and 32V, the predecessor to 3BSD. As a result, all versions of BSD, including those over which the lawsuit was conducted, are now freely available.
Other free UNIX-like operating systems
FreeBSD isn't the only free UNIX-like operating system available—it's not even the best-known one. The best-known free UNIX-like operating system is undoubtedly Linux, but there are also a number of other BSD-derived operating systems. We'll look at them first:
386/BSD was the original free BSD operating system, introduced by William F. Jolitz in 1992. It never progressed beyond a test stage: instead, two derivative operating systems arose, FreeBSD and NetBSD. 386/BSD has been obsolete for years.
NetBSD is an operating system which, to the casual observer, is almost identical to FreeBSD. The main differences are that NetBSD concentrates on hardware independence, whereas FreeBSD concentrates on performance. FreeBSD also tries harder to be easy to understand for a beginner. You can find more information about NetBSD at http://www.NetBSD.org.
Apple computer introduced Version 10 (X) of its Mac OS in early 2001. It is a big deviation from previous versions of Mac OS: it is based on a Mach microkernel with a BSD environment. The base system (Darwin) is also free. FreeBSD and Darwin are compatible at the user source code level.
You could get the impression that there are lots of different, incompatible BSD versions. In fact, from a user viewpoint they're all very similar to each other, much more than the individual distributions of Linux, which we'll look at next.
FreeBSD and Linux
In 1991, Linux Torvalds, then a student in Helsinki, Finland, decided he wanted to run UNIX on his home computer. Atthat time the BSD sources were not freely available, and so Linus wrote his own version of UNIX, which he called Linux.
Linux is a superb example of how a few dedicated; clever people can produce an operating system that is better than well-known commercial systems developed by a large number of trained software engineers. It is better even than a number of commercial UNIX systems.
Obviously, I prefer FreeBSD over Linux, or I wouldn't be writing this course , but the differences between FreeBSD and Linux are more a matter of philosophy rather than of concept. Here are a few contrasts:
Differences between FreeBSD and Linux
| FreeBSD is a direct descendent of the original UNIX, though it contains no residual AT T code | Linux is a clone and never contained any ATT code |
| FreeBSD is a complete operating system, maintained by a central group of software developers under the Concurrent Versions System which maintains a complete history of the project development. There is only one distribution of FreeBSD | Linux is a kernel, personally maintained by Linus Torvalds and a few trusted companions. The non-kernel programs supplied with Linux are part of a distribution, of which there are several. Distributions are not completely compatible with each other. |
| The FreeBSD development style emphasizes accountability and documentation of changes | The Linux kernel is maintained by a small number of people who keep track of all changes. Unofficial patches abound. |
| The kernel supplied with a specific release of FreeBSD is clearly defined. | Linux distributions often have subtly different kernels. The differences are not always documented |
| FreeBSD aims to be a stable production environment | Many versions of Linux are still "bleeding edge" development environments. This is changing rapidly, however |
| As a result of the centralized development style, FreeBSD is straightforward and easy to install | The ease of installation of Linux depends on the distribution. If you switch from one distribution of Linux to another, you’ll have to learn a new set of installation tools. |
| FreeBSD is still relatively unknown, since its distribution was initially restricted due to the ATT lawsuits | Linux did not have any lawsuits to contend with, so for some time it was thought to be the only free UNIX-type system available |
| As a result of the lack of knowledge of FreeBSD, relatively little commercial software is available for it | A growing amount of commercial software is becoming available for Linux. |
| As a result of the smaller user base, FreeBSD is less likely to have drivers for brand-new boards than Linux | Just about any new board will soon have a driver for Linux |
| Because of the lack of commercial applications and drivers for FreeBSD, Free-BSD runs most Linux programs, whether commercial or not | Linux appears not to need to be able to run FreeBSD programs |
| FreeBSD is licensed under the BSD license—see page 6. There are very few restrictions on its use. | Linux is licensed under the GNU General Public License. Further details are athttp://www.gnu.org/licenses/gpl.html.comparison with the BSD license, it imposes significant restrictions on what you can do with the source code. |
| FreeBSD Linux has aficionados who are prepared to pared to fame anybody who dares suggest fame anybody who dares suggest that it's that it's not better than Linux | In summary, Linux is also a very good operating system. For many, it's better than FreeBSD |
FreeBSD system documentation
FreeBSD comes with a considerable quantity of documentation which we'll look at in the following few pages:
The FreeBSD Documentation Project maintains a collection of "books," documents in HTML or PDF format which can also be accessed online. They're installed in the directory hierarchy /usr/share/doc.
The traditional UNIX document format is man pages, individual documents describing specific functionality. They’re short and to the point of being cryptic, but if you know what you're looking for, they have just the right amount of detail. They're not a good introduction.
The GNU project introduced their own document format, GNU info. Some GNU programs have no other form of documentation.
Reading online documentation
You'll find a number of HTML documents in the directory /usr/share/doc/en/books:
/usr/share/doc/en/books/faq/index.html contains the FreeBSD FAQ (Frequently Asked Questions). It's just what it says it is: a list of questions that people frequently ask about FreeBSD, with answers of course.
/usr/share/doc/en/books/fdp-primer/index.html is a primer for the FreeBSD Documentation Project,
/usr/share/doc/en/books/handbook/index.html is the FreeBSD online handbook. It contains a lot of information
specifically about FreeBSD, including a deeper discussion of many topics in this course .
/usr/share/doc/en/books/porters-handbook/index.html is a handbook for contributors to the FreeBSD Ports Collection, which we'll discuss in Chapter 9, The Ports Collection.
/usr/share/doc/en/books/ppp-primer/index.html contains a somewhat dated document about setting up PPP. If you have trouble with Chapter 20, Configuring PPP, you may find it useful.
In addition to the directory /usr/share/doc/en/books, there's also a directory /usr/share/doc/en/articles with a number of shorter items of documentation.
Note the component en in the pathnames above. That stands for English.A number of these books are also installed in other languages: change en to de for a German version, to es for Spanish, to fr for French, to ja for Japanese, to ru for Russian, or to zh for Chinese. Translation efforts are continuing, so you may find documentation in other languages as well.
If you're running X, you can use a browser like mozilla to read the documents. If you don’t have Running yet, use lynx. Both of these programs are included in the CD-ROM distribution. To install them, use sysinstall, which is described on page 92.
lynx is not a complete substitute for complete web browsers such as mozilla:since it is text-only, it is not capable of displaying the large majority of web pages correctly. It's good enough for reading most of the FreeBSD online documentation, however.
In each case, you start the browser with the name of the document, for example:
$ lynx /usr/share/doc/en/books/handbook/index.html
$ mozilla /usr/share/doc/en/books/handbook/index.html
Enter the after the invocation of mozilla to free up the window in which you invoke it: mozilla opens its own window.
If you haven’t installed the documentation, you can still access it from the Live File system CD-ROM. Assuming the CD-ROM is mounted on /cdrom, choose the file /cdrom/usr/share/doc/en/books/handbook/index.html.
Alternatively, you can print out the handbook. This is a little more difficult, and of course you'll lose the hypertext references, but you may prefer it in this form. To format the handbook for printing, you'll need a PostScript printer or ghostscript. See page 271 for more details of how to print PostScript.
The printable version of the documentation doesn't usually come with the CD-ROM distribution. You can pick it up with ftp
(see page 433) from ftp://ftp.FreeBSD.ORG/pub/FreeBSD/doc/,which has the same directory structure as described above. For example, you would download the handbook in PostScript form from ftp://ftp.FreeBSD.ORG/pub/FreeBSD/doc/en/books/handbook/book.ps.bz2.
The online manual
The most comprehensive documentation on FreeBSD is the online manual, usually referred to as the man pages. Nearly every program, file, library function, device or interface on the system comes with a short reference manual explaining the basic operation and various arguments. If you were to print it out, it would run to well over 8,000 pages.
When online, you view the man pages with the command man. For example, to learn more about the command ls, type:
$ man ls
LS(1) FreeBSD Reference Manual LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [-ACFLRTacdfiloqrstu1][file ... ]
DESCRIPTION
For each operand that names a file of a type other than directory, ls
displays its name as well as any requested, associated information. For
each operand that names a file of type directory, ls displays the names.
(etc)
In this particular example, with the exception of the first line, the text in constant width bold is not input, it's the way it appears on the screen.
The online manual is divided up into sections numbered:
User commands
System calls and error numbers
Functions in the C libraries
Device drivers
File formats
Games and other diversions
Miscellaneous information
System maintenance and operation commands
Kernel interface documentation
In some cases, the same topic may appear in more than one section of the online manual. For example, there is a user command chmod and a system call chmod(). In this case, you can tell the man command which you want by specifying the section number:
$ man 1 chmod
This command displays the manual page for the user command chmod. References to a particular section of the online manual are traditionally placed in parentheses in written documentation. For example, chmod(l) refers to the user command chmod, and chmod(2) means the systcode call.
This is fine if you know the name of the command and forgot how to use it, but what if you can't recall the command name? You can use man to search for keywords in the command descriptions by using the -k option, or by starting the program apropos:
$ man -k mail $
apropos mail
Both of these commands do the same thing: they show the names of the man pages that have the keyword mail in their descriptions.
Alternatively, you may browse through the /usr/bin directory, which contains most of the system executables. You'll see lots of file names, but you don't have any idea what they do. To find out, enter one of the lines:
$ cd /usr/bin; man -f *
$ cd /usr/bin; whatis *
Both of these commands do the same thing: they print out a one-line summary of the purpose of the program:
$ cd /usr/bin; man -f *
a2p(1) - Awk to Perl translator
addftinfo(l) - add information to troff font files for use with groff
apply(l) - apply a command to a set of arguments
apropos(1) - search the whatis database
...etc
Printing man pages
If you prefer to have man pages in print, rather than on the screen, you can do this in two different ways:
The simpler way is to redirect the output to the spooler:
$ man ls | lpr
This gives you a printed version that looks pretty much like the original on the screen, except that you may not get bold or underlined text.
You can get typeset output with troff:
$ man -t ls | lpr
This gives you a properly typeset version of the man page, but it requires that your spooling system understand PostScript—see page 271 for more
details of printing PostScript, even on printers that don't understand PostScript.
GNU info
The Free Software Foundation has its own online hypertext browser called info. Many FSF programs come with either no man page at all, or with an excuse for a man page (gcc, for example). To read the online documentation, you need to browse the info files with the info program, or from Emacs with the info mode. To start info,simply type:
$ info
In Emacs, enter CTRL-h i or ALT-x info. Whichever way you start info, you can get brief introduction by typing h, and a quick command reference by typing ?.
Other documentation on FreeBSD
FreeBSD users have access to probably more top-quality documentation than just about any other operating system. Remember that word UNIX is trademarked. Sure, the lawyers tell us that we can't refer to FreeBSD as UNIX, because UNIX belongs to the Open Group. That doesn't make the slightest difference to the fact that nearly every book on UNIX applies more directly to FreeBSD than any other flavour of UNIX. Why?
Commercial UNIX vendors have a problem, and FreeBSD doesn't help them: why should people buy their products when you can get it free from the FreeBSD Project (or, for that matter, from other free UNIX-like operating systems such as NetBSD, OpenBSD and Linux)? One obvious reason would be "value-added features." So they add features or fix weak points in the system, put a copyright on the changes, and help lock their customers in to their particular implementation. As long as the changes are really useful, this is legitimate, but it does make the operating system less compatible with "standard UNIX," and the books about standard UNIX are less applicable.
In addition, many books are written by people with an academic background. In the UNIX world, this means that they are more likely than the average user to have been exposed to BSD. Many general UNIX books handle primarily BSD, possibly with an additional chapter on the commercial System V version.
In Appendix A, Bibliography, you’ll find a list of books that I find worthwhile. I'd like to single out some that I find particularly good, and that I frequently use myself:
UNIX Power 7oo/s, by Jeny Peek, Tim O'Reilly, and Mike Loukides, is a superb collection of interesting information, including a CD-ROM. Recommended for everybody, from beginners to experts.
UNIX for the Impatient ,by Paul W. Abrahams and Bruce R. Larson, is more similar to this book, but it includes a lot more material on specific products, such as shells and the Emacs editor.
The UNIX System Administration Handbook, by Evi Nemeth, Garth Snyder, Scott Seebass, and Trent R. Hein, is one of the best books on systems administration I have seen. It covers a number different UNIX systems, including an older version of FreeBSD.
There are also many active Internet groups that deal with FreeBSD. Read about them in the online handbook.
The FreeBSD community
FreeBSD was developed by a world-wide group of developers. It could not have happened without the Internet. Many of the key players have never even met each other in person; the main means of communication is via the Internet. If you have any kind of Internet connection, you can participate as well. If you don't have an Internet connection, it's about time you got one. The connection doesn't have to be complete: if you can receive email, you can participate. On the other hand, FreeBSD includes all the software you need for a complete Internet connection, not the very limited subset that most PC-based "Internet" packages offer you.
Mailing lists
As it says in the copyright, FreeBSD is supplied as-is, without any support liability. If you're on the Internet, you're not alone, however. Liability is one thing, but there are plenty of people prepared to help you, most for free, some for fee. A good place to start is with the mailing lists. There are a number of mailing lists that you can join. Some of the more interesting ones are:
FreeBSD-questions@FreeBSD.org is the list to which you may send general questions, in particular on how to use FreeBSD. If you have difficulty understanding anything in this course , for example, this is the right place to ask. It's also the list to use if you're not sure which is the most appropriate.
FreeBSD-questions@FreeBSD.org is a list for newcomers to FreeBSD. It's intended for people who feel a little daunted by the system and need a bit of reassurance. It's not the right place to ask any kind of technical question.
FreeBSD-questions@FreeBSD.org is a technical discussion list.
FreeBSD-questions@FreeBSD.org is an obligatory list for people who run the development version of FreeBSD, called FreeBSD-CURRENT.
FreeBSD-questions@FreeBSD.org is a similar list for people who run the more recent stable version of FreeBSD, called FreeBSD-STABLE. We'll talk about these versions on page 582. Unlike the case for FreeBSD-CURRENT users, it's not obligatory for
FreeBSD-STABLE users to subscribe to FreeBSD-stable.
You can find a complete list of FreeBSD mailing lists on the web site, currently at
http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/eresources.html. This address is part of the online handbook and may change when the handbook is modified; follow the link if it is no longer valid, or if you can't be bothered typing in the URI.
The mailing lists are run by mailman (in the Ports Collection). Join them via the web interface mentioned above. You will receive a mail message from mailman asking you to confirm your subscription by replying to the message. You don't need to put anything in the reply: the reply address is used once only, and you're the only person who will ever see it, so the system knows that it's you by the fact that you replied at all. You also have the option of confirming via a web interface with a specially generated URI. Similar considerations apply in this case.
FreeBSD mailing lists can have a very high volume of traffic. The FreeBSD-questions mailing list, for example, has thousands of subscribers, and many of them are themselves mailing lists. It receives over a hundred messages every day. That's about a million messages a day in total for just one mailing list, so when you sign up for a mailing list, be sure to read the charter. You can find the URI from the mailman confirmation message. It's also a good idea to "lurk" (listen, but not say anything) on the mailing list a while before posting anything: each list has its own traditions.
When submitting a question to FreeBSD-questions, consider the following points:
Remember that nobody gets paid for answering a FreeBSD question. They do it of their own free will. You can influence this free will positively by submitting a well-formulated question supplying as much relevant information as possible. You can influence this free will negatively by submitting an incomplete, illegible, or rude question. It's perfectly possible to send a message to FreeBSD-questions and not get an answer even if you follow these rules. It's much more possible to not get an answer if you don't.
Not everybody who answers FreeBSD questions reads every message: they look at the subject line and decide whether it interests them. Clearly, it's in your interest to specify a subject. "FreeBSD problem" or "Help" aren't enough. If you provide no subject at all, many people won’t bother reading it. If your subject isn'tspecific enough, the people who can answer it may not read it.
When sending a new message, well, send a new message. Don't just reply to some other message, erase the old content and change the subject line. That leaves an In-Reply-To: header which many mail readers use to thread messages, so your message shows up as a reply to some other message. People often delete messages a whole thread at a time, so apart from irritating people, you also run a chance of having the message deleted unread.
Format your message so that it is legible, and PLEASE DON'T SHOUT!!!!!. It's really painful to try to read a message written full of typos or without any line breaks. Alot of badly formatted messages come from bad mailers or badly configured mailers. The following mailers are known to send out badly formatted messages without you finding out about them:
Eudora
Exmh
Microsoft Exchange
Microsoft Internet Mail
Microsoft Outlook
Netscape
As you can see, the mailers in the Microsoft world are frequent offenders. If at all possible, use a UNIX mailer. If you must use a mailer under Microsoft environments, make sure it is set up correctly. Try not to use MIME: a lot of people use mailers which don't get on very well with MIME.
For further information on this subject, check out http://www.lemis.com/email.html.
Make sure your time and time zone are set correctly. This may seem a little silly, since your message still gets there, but many of the people you are trying to reach get several hundred messages a day.Theyfrequently sort the incoming messages by subject and by date, and if your message doesn't come before the first answer, they may assume they missed it and not bother to look.
Don’t include unrelated questions in the same message. Firstly, along message tends to scare people off, and secondly, it's more difficult to get all the people who can answer all the questions to read the message.
Specify as much information as possible. This is a difficult area: the information you need to submit depends on the problem. Here’s start:
If you get error messages, don't say "I get error messages", say (for example) "I get the error message
No route to host".
If your system panics, don'tsay "My system panicked", say (for example) "my system panicked with the message free vnode isn't".
If you have difficulty installing FreeBSD, please tell us what hardware you have, particularly if you have something unusual.
If, for example, you have difficulty getting PPP to run, describe the configuration. Which version of PPP do you use? What kind of authentication do you have? Do you have a static or dynamic IP address? What kind of messages do you get in the log file? See Chapter 20, Configuring PPP, for more details in this particular case.
If you don't get an answer immediately, or if you don't even see your own message appear on the list immediately, don't resend the message. Wait at least 24 hours. The FreeBSD mailer offloads messages to a number of subordinate mailers around the world. Usually the messages come through in a matter of seconds, but sometimes it can take several hours for the mail to get through.
If you do all this, and you still don't get an answer, there could be other reasons. For example, the problem is so complicated that nobody knows the answer, or the person who does know the answer was offine. If you don't get an answer after, say, a week, it might help to re-send the message. If you don't get an answer to your second message, though, you're probably not going to get one from this forum. Resending the same message again and again will only make you unpopular.
How to follow up to a question
Often you will want to send in additional information to a question you have already sent. The best way to do this is to reply to your original message. This has three advantages:
You include the original message text, so people will know what you're talking about. Don't forget to trim unnecessary text, though.
The text in the subject line stays the same (you did remember to put one in, didn't you?). Many mailers will sort messages by subject. This helps group messages together.
The message reference numbers in the header will refer to the previous message. Some mailers, such as mutt, can thread messages, showing the exact relationships between the messages.
There are more suggestions, in particular for answering questions, at http://www.lemis.com/questions.html. See also Chapter 26, and the support page at http://www. FreeBSD.org/support.html.
In addition, a number of companies offer support for FreeBSD. See the web page http://www.FreeBSD.org/commercial/consulting_bycat.html for some possibilities.
Unsubscribing from the mailing lists
There's a lot of traffic on the mailing lists, particularly on FreeBSD-questions. You may find you can't take it and want to get out again. Again, you unsubscribe from the list either via the web or via a special mail address, not by sending mail to the the list. Each message you get from the mailing lists finishes with the following text:
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
Don't be one of those people who send the unsubscribe request to the mailing list instead.
User groups
But how about meeting FreeBSD users face to face? There are a number of user groups around the world. If you live in a big city, chances are that there's one near you. Check http://www.FreeBSD.org/support.html#user for a list. If you don't find one, consider taking the initiative and starting one.
In addition, USENIX holds an annual conference, the for more details.
Reporting bugs
If you find something wrong with FreeBSD, we want to know about it, so that we can fix it. To report a bug, use the send-pr program to send it as a mail message.
There used to be a web form at http://www.FreeBSD.org/send-pr.html, but it has been closed down due to abuse.
The Berkeley daemon
The little daemon at the right symbolizes BSD. It is included with kind permission of Marshall Kirk McKusick, one of the leading members of the former Computer Sciences Research Group at the University of California at Berkeley, and owner of the daemon's copyright. Kirk also wrote the foreword to this course .
(рис 1.1)
The daemon has occasionally given rise to a certain amount of confusion. In fact, it's a joking reference to processes that run in the background—see Chapter 8, Taking control, page 150, for a description. The outside world occasionally sees things differently, as the following story indicates:
Newsgroups: alt.humor.best-of-usenet
Subject: [comp.org.usenix] A Great Daemon Story
From: Rob Kolstad <kolstad@bsdi.com>
Newsgroups: comp.org.usenix
Subject: A Great Daemon Story
Linda Branagan is an expert on daemons. She has a T-shirt that sports the daemon in tennis shoes that appears on the cover of the 4.3BSD manuals and The Design and Implementation of the 4.3BSD UNIX Operating System by S. Leffler, M. McKusick, M. Karels, J. Quarterman, Addison Wesley Publishing Company, Reading, MA 1989.
She tells the following story about wearing the 4.3BSD daemon T-shirt:
Last week I walked into a local "home style cookin' restaurant/watering hole" in Texas to pick up a take-out order. I spoke briefly to the waitress behind the counter, who told me my order would be done in a few minutes.
So, while I was busy gazing at the farm implements hanging on the walls, I was approached by two "natives." These guys might just be the original Texas rednecks.
"Pardon us, ma'am. Mind if we ask you a question?"
Well, people keep telling me that Texans are real friendly, so I nodded.
"Are you a Satanist?"
Well, at least they didn't ask me if I liked to party.
"Uh, no, I can't say that I am."
"Gee, ma'am. Are you sure about that?" they asked.
I put on my biggest, brightest Dallas Cowboys cheerleader smile and said, "No, I'm positive. The closest I've ever come to Satanism is watching Geraldo."
"Hmmm. Interesting. See, we was just wondering why It is you have the lord of darkness on your chest there."
I was this close to slapping one of them and causing a scene—then I stopped and noticed the shirt I happened to be wearing that day. Sure enough, it had a picture of a small, devilish-looking creature that has for some time now been associated with a certain operating system. In this particular representation, the creature was wearing sneakers.
They continued: "See, ma'am, we don'texactly appreciate it when people showoff pictures of the devil. Especially when he'slookin' so friendly."
These idiots sounded terrifyingly serious.
Me: "Oh, well, see, this isn't really the devil, it's just, well, it's sort of a mascot.
Native: "And what kind of football team has the devil as a mascot?"
Me: "Oh, it's not a team. It's an operating—uh, a kind of computer."
I figured that an ATM machine was about as much technology as these guys could handle, and I knew that if I so much as uttered the word "UNIX" I would only make things worse.
Native: "Where does this satanical computer come from?"
Me: "California. And there's nothing satanical about it really."
Somewhere along the line here, the waitress noticed my predicament—but these guys probably outweighed her by 600 pounds, so all she did was look at me sympathetically and run off into the kitchen.
Native: "Ma'am, I think you're lying. And we'd appreciate it if you'd leave the premises now."
Fortunately, the waitress returned that very instant with my order, and they agreed that it would be okay for me to actually pay for my food before I left. While I was at the cash register, they am used themselves by talking to each other.
Native #1: "Do you think the police know about these devil computers?"
Native #2: "If they come from California, then the FBI oughta know about 'em."
Theye scorted me to the door. I tried one last time: "You're really blowing this all out of proportion. Alot of people use this 'kind of computers.' Universities, researchers, businesses. They're actually very useful."
Big, big, big mistake. I should have guessed at what came next.
Native:"Does the government use these devil computers?"
Me: "Yes."
Another big boo-boo.
Native:"And does the government pay for 'em? With our tax dollars?"
Idecided that it was time to jump ship.
Me: "No. Nope. Not at all. Your tax dollars never entered the picture at all. I promise. No sir, not a penny. Our good Christian congressmen would never let something like that happen. Nope. Never. Bye."
Texas. What acountry.
The daemon tradition goes back quite a way. Asrecently as 1996, after the publication of the first edition of this book, the following message went through the FreeBSD-chat mailing list:
To: "Jonathan M. Bresler" <jmb@freefall.freebsd.org>
Cc: obrien@antares.aero.org (Mike O'Brien),
joerg_wunsch@uriah.heep.sax.de,
chat@FreeBSD.org, juphoff@tarsier.cv.nrao.edu
Date: Tue, 07 May 1996 16:27:20 -0700
Sender: owner-chat@FreeBSD.org
>details and gifs PLEASE!
If you insist. :-)
Sherman, set the Wayback Machine for around 1976 or so (see Peter Salus' A
Quarter Century of UNIX for details), when the first really national UNIX
meeting was held in Urbana, Illinois. This would be after the "forty people
in a Brooklyn classroom" meeting held by Mel Ferentz (yeah I was at that too)
and the more-or-less simultaneous West Coast meeting(s) hosted by SRI, but before
the UNIX Users Group was really incorporated as a going concern.
I knew Ken Thompson and Dennis Ritchie would be there. I was living in Chicago
at the time, and so was comic artist Phil Foglio, whose star was just beginning
to rise. At that time I was a bonded locksmith. Phil's roommate had unexpectedly
split town, and he was the only one who knew the combination to the wall safe in
their apartment. This is the only apartment I've ever seen that had a wall safe,
but it sure did have one, and Phil had some stuff locked in there. I didn't hold
out much hope, since safes are far beyond where I was (and am) in my locks mithing
sphere of competence, but I figured "no guts no glory" and told him I'd
give it a whack. In return, I told him, he could do some T-shirt art for me. He readily agreed.
Wonder of wonders, this safe was vulnerable to the same algorithm that Master
locks used to be susceptible to. I opened it in about 15 minutes of manipulation.
It was my greatest moment as a locksmith and Phil was overjoyed. I went down to my
lab and shot some Polaroid snaps of the PDP-11 system I was running UNIX on at the
time, and gave it to Phil with some descriptions of the visual puns I wanted: pipes,
demons with forks running along the pipes, a "bit bucket" named /dev/null, all that.
What Phil came up with is the artwork that graced the first decade's worth of
"UNIX T-shirts," which were made by a Ma and Paoperation in a Chicago
suburb. They turned out transfer art using a 3M color copier in their basement.
Hence, the PDP-11 is reversed (the tape drives are backwards) but since Phil left off
the front panel, this was hard to tell. His trademark signature was photo-reversed,
but was recopied by the T-shirt people and "re-forwardized," which is why
it looks a little funny compared to his real signature.
Dozens and dozens of these shirts were produced. Bell Labs alone accounted for
an order of something like 200 for a big picnic. However, only four (4) REAL
originals were produced: these have a distinctive red collar and sleeve cuff.
One went to Ken, one to Dennis, one to me, and one to my then-wife. I now possess
the latter two shirts. Ken and Dennis were presented with their shirts at the Urbana conference.
People ordered these shirts direct from the Chicago couple. Many years later,
when I was living in LA, I got a call from Armando Stettner, then at DEC,
asking about that now-famous artwork. I told him I hadn't talked to the Illinois
T-shirt makers in years. At his request I called them up. They'd folded the operation
years ago and were within days of discarding all the old artwork. I requested its return,
and duly received It back in the mail. It looked strange, seeing it again in its
original form, a mirror image of the shirts with which I and everyone else were now familiar.
I sent the artwork to Armando, who wanted to give it to the Ultrix marketing people.
They came out with the Ultrix poster that showed a nice shiny Ultrix machine
contrasted with the chewing-gum-and-string PDP-11 UNIX people were familiar with.
They still have the artwork, so far as I know.
I no longer recall the exact contents of the letter I sent along with the artwork.
I did say that as far as I knew, Phil had no residual rights to the art,
since it was a 'work made for hire', though nothing was in writing
(and note this was decades before the new copyright law). I do not now recall
if I explicitly assigned all rights to DEC. What is certain is that John Lassiter's daemon,
whether knowingly borrowed from the original, or created by parallel evolution,
postdates the first horde of UNIX daemons by at least a decade and probably more.
And if Lassiter's daemon looks a lot like a Phil Foglio creation, there's are a son.
I have never scanned in Phil's artwork; I've hardly ever scanned in anything,
so I have no GIFs to show. But I have some very very old UNIX T-shirts in
startlingly good condition. Better condition than I am at any rate:
I no longer fit into either of them.
Mike O'Brien
Creaky antique
Note the date of this message: it appeared since the first edition of this book. Since then, the daemon image has been scanned in, and you can find a version at http://www. mckusick.com/beastie/shirts/usenix.html