-Congratulations on installing FreeBSD! This introduction is for people new to both FreeBSD _and_ UNIX(R)-so it starts with basics.
+Congratulations on installing FreeBSD! This introduction is for people new to both FreeBSD _and_ UNIX(R)-so it starts with basics. _This guide reflects typical usage on modern versions of FreeBSD (13.x through 15.x)._
'''
@@ -52,206 +54,239 @@
== Logging in and Getting Out
Log in (when you see `login:`) as a user you created during installation or as `root`.
-(Your FreeBSD installation will already have an account for `root`;
-who can go anywhere and do anything, including deleting essential files, so be careful!)
-The symbols % and # in the following stand for the prompt (yours may be different), with % indicating an ordinary user and # indicating `root`.
+(Your FreeBSD installation already has an account for `root`;
+this user can go anywhere and do anything, including deleting essential files, so be careful!)
+The symbols % and # in the following examples represent the shell prompt (yours may be different).
+Conventionally, % indicates an ordinary user and # indicates `root`.
-To log out (and get a new `login:` prompt) type
+To log out (and return to a `login:` prompt) type
[source,shell]
....
-# exit
+% exit
....
-as often as necessary.
-Yes, press kbd:[enter] after commands, and remember that UNIX(R) is case-sensitive-``exit``, not `EXIT`.
+as many times as necessary.
+Press kbd:[Enter] after commands, and remember that UNIX(R) is case-sensitive-``exit``, not `EXIT`.
To shut down the machine type
[source,shell]
....
-# /sbin/shutdown -h now
+# shutdown -p now
....
-Or to reboot type
+To reboot the system type
[source,shell]
....
-# /sbin/shutdown -r now
+# shutdown -r now
....
-or
-
-[source,shell]
-....
-# /sbin/reboot
-....
-
-You can also reboot with kbd:[Ctrl+Alt+Delete].
-Give it a little time to do its work.
-This is equivalent to `/sbin/reboot` in recent releases of FreeBSD and is much, much better than hitting the reset button.
-You do not want to have to reinstall this thing, do you?
+You can also reboot from the system console with kbd:[Ctrl+Alt+Delete].
+Allow the system a little time to shut down cleanly.
+This is much better than using the hardware reset button, as it lets the operating system properly stop services and synchronize disks.
[[adding-a-user]]
== Adding a User with Root Privileges
-If you did not create any users when you installed the system and are thus logged in as `root`, you should probably create a user now with
+If you did not create any users when you installed the system and are thus logged in as `root`, you should create a regular user account now with
[source,shell]
....
# adduser
....
-The first time you use `adduser`, it might ask for some defaults to save.
-You might want to make the default shell man:csh[1] instead of man:sh[1], if it suggests `sh` as the default.
-Otherwise just press enter to accept each default.
-These defaults are saved in [.filename]#/etc/adduser.conf#, an editable file.
+The first time you use man:adduser[8], it may ask for some defaults to save.
+You can usually accept the suggested values by pressing kbd:[Enter].
+These defaults are stored in [.filename]#/etc/adduser.conf#, which can be edited later if necessary.
Suppose you create a user `jack` with full name _Jack Benimble_.
-Give `jack` a password if security (even kids around who might pound on the keyboard) is an issue.
-When it asks you if you want to invite `jack` into other groups, type `wheel`
+Give `jack` a password when prompted.
+
+When man:adduser[8] asks whether to invite `jack` into other groups, type `wheel`:
[source,shell]
....
Login group is "jack". Invite jack into other groups: wheel
....
-This will make it possible to log in as `jack` and use the man:su[1] command to become `root`.
-Then you will not get scolded any more for logging in as `root`.
+Members of the `wheel` group are allowed to use the man:su[1] command to become `root`.
+This makes it possible to log in as `jack` and use man:su[1] only when administrative privileges are required, instead of logging in directly as `root`.
+
+You can quit `adduser` at any time by typing kbd:[Ctrl+C].
+At the end you will be asked to confirm the new account or cancel it by typing `n`.
+
+Once you have created the user, type `exit` to return to a login prompt and log in as `jack`.
+In general, it is a good idea to do as much work as possible as an ordinary user who does not have the power — and risk — of `root`.
-You can quit `adduser` any time by typing kbd:[Ctrl+C], and at the end you will have a chance to approve your new user or simply type kbd:[n] for no.
-You might want to create a second new user so that when you edit `jack`'s login files, you will have a hot spare in case something goes wrong.
+If you already created a user and want that user to be able to `su` to `root`, you can add the user to the `wheel` group.
+This can be done by editing the file [.filename]#/etc/group# or by using the man:pw[8] command, for example:
-Once you have done this, use `exit` to get back to a login prompt and log in as `jack`.
-In general, it is a good idea to do as much work as possible as an ordinary user who does not have the power-and risk-of `root`.
+[source,shell]
+....
+# pw groupmod wheel -m jack
+....
-If you already created a user and you want the user to be able to `su` to `root`, you can log in as `root` and edit the file [.filename]#/etc/group#, adding `jack` to the first line (the group `wheel`).
-But first you need to practice man:vi[1], the text editor-or use the simpler text editor, man:ee[1], installed on recent versions of FreeBSD.
+To edit configuration files you can use the text editor man:vi[1] or the simpler editor man:ee[1], which is included in the FreeBSD base system.
-To delete a user, use `rmuser`.
+To delete a user, use man:rmuser[8].
[[looking-around]]
== Looking Around
-Logged in as an ordinary user, look around and try out some commands that will access the sources of help and information within FreeBSD.
+Logged in as an ordinary user, look around and try out some commands that provide help and information within FreeBSD.
Here are some commands and what they do:
`id`::
-Tells you who you are!
+Tells you who you are.
`pwd`::
-Shows you where you are-the current working directory.
+Shows the current working directory.
`ls`::
Lists the files in the current directory.
`ls -F`::
-Lists the files in the current directory with a * after executables, a `/` after directories, and an `@` after symbolic links.
+Lists the files in the current directory with a `*` after executables, a `/` after directories, and an `@` after symbolic links.
`ls -l`::
-Lists the files in long format-size, date, permissions.
+Lists the files in long format, showing size, date, permissions, and other information.
`ls -a`::
-Lists hidden "dot" files with the others.
-If you are `root`, the "dot" files show up without the `-a` switch.
+Lists hidden "dot" files together with the others.
+If you are `root`, the "dot" files are shown even without the `-a` switch.
`cd`::
-Changes directories. `cd ..` backs up one level; note the space after `cd`.
-`cd /usr/local` goes there. `cd ~` goes to the home directory of the person logged in-e.g., [.filename]#/usr/home/jack#.
-Try `cd /cdrom`, and then `ls`, to find out if your CDROM is mounted and working.
+Changes directories. `cd ..` moves up one level; note the space after `cd`.
+`cd /usr/local` changes to that directory.
+`cd ~` goes to the home directory of the user who is logged in, for example [.filename]#/usr/home/jack#.
`less _filename_`::
-Lets you look at a file (named _filename_) without changing it.
+Lets you view a file (named _filename_) without changing it.
Try `less /etc/fstab`.
Type `q` to quit.
`cat _filename_`::
-Displays _filename_ on screen.
-If it is too long and you can see only the end of it, press kbd:[ScrollLock] and use the kbd:[up-arrow] to move backward; you can use kbd:[ScrollLock] with manual pages too.
-Press kbd:[ScrollLock] again to quit scrolling.
-You might want to try `cat` on some of the dot files in your home directory-`cat .cshrc`, `cat .login`, `cat .profile`.
+Displays _filename_ on the screen.
+If the file is long, it may scroll past quickly; using `less` is often more convenient for viewing longer files.
+You might want to try `cat` on some of the dot files in your home directory, such as `cat .cshrc`, `cat .login`, or `cat .profile`.
+
+You may notice aliases for some commonly used commands in your shell configuration files.
+These aliases provide convenient shortcuts for frequently used command options.
+
+If you are using the `sh` shell, aliases can be defined in your personal shell configuration file, usually [.filename]#.profile#.
+System-wide settings for `sh` users may be placed in files such as [.filename]#/etc/profile#.
-You will notice aliases in [.filename]#.cshrc# for some of the `ls` commands (they are very convenient).
-You can create other aliases by editing [.filename]#.cshrc#.
-You can make these aliases available to all users on the system by putting them in the system-wide `csh` configuration file, [.filename]#/etc/csh.cshrc#.
+If you are using the `tcsh` shell, some aliases for commands such as `ls` may already be defined in the file [.filename]#.cshrc# in your home directory.
+You can create additional aliases by editing [.filename]#.cshrc# or [.filename]#.tcshrc#.
+Aliases for all users of `tcsh` can be defined in the system-wide configuration file [.filename]#/etc/csh.cshrc#.
[[getting-help]]
== Getting Help and Information
-Here are some useful sources of help.
-_Text_ stands for something of your choice that you type in-usually a command or filename.
-
-`apropos _text_`::
-Everything containing string _text_ in the `whatis database`.
+FreeBSD provides several built-in sources of help and documentation.
+In the examples below, _text_ stands for something you type—usually a command name or a filename.
`man _text_`::
-The manual page for _text_.
-The major source of documentation for UNIX(R) systems.
-`man ls` will tell you all the ways to use `ls`.
-Press kbd:[Enter] to move through text, kbd:[Ctrl+B] to go back a page, kbd:[Ctrl+F] to go forward, kbd:[q] or kbd:[Ctrl+C] to quit.
+Displays the manual page for _text_.
+Manual pages are the primary source of documentation on UNIX(R) systems.
+For example, `man ls` explains how to use the `ls` command.
+Press kbd:[Enter] to move through the text, kbd:[Ctrl+B] to go back a page, kbd:[Ctrl+F] to go forward, and kbd:[q] to quit.
-`which _text_`::
-Tells you where in the user's path the command _text_ is found.
-
-`locate _text_`::
-All the paths where the string _text_ is found.
+`apropos _text_`::
+Searches the manual page descriptions for the string _text_.
+This is useful if you know what you want to do but do not know the name of the command.
`whatis _text_`::
-Tells you what the command _text_ does and its manual page.
-Typing `whatis *` will tell you about all the binaries in the current directory.
+Displays a short description of the command _text_ and the section of the manual where it is documented.
+
+`which _text_`::
+Shows which executable will be run when you type the command _text_.
+This can be useful if multiple versions of a program are installed.
`whereis _text_`::
-Finds the file _text_, giving its full path.
+Searches for the binary, source, and manual page files for _text_.
+
+`locate _text_`::
+Searches a database of filenames and shows paths containing the string _text_.
+This is often faster than searching the filesystem directly.
-You might want to try using `whatis` on some common useful commands like `cat`, `more`, `grep`, `mv`, `find`, `tar`, `chmod`, `chown`, `date`, and `script`.
-`more` lets you read a page at a time as it does in DOS, e.g., `ls -l | more` or `more _filename_`.
-The * works as a wildcard-e.g., `ls w*` will show you files beginning with `w`.
+You might want to try `whatis` on some commonly used commands such as `cat`, `grep`, `mv`, `find`, `tar`, `chmod`, `chown`, `date`, and `script`. man:more[1] lets you read a page at a time, e.g., `ls -l | more` or `more filename`.
+The `\*` character can be used as a wildcard.
+For example, `ls w*` lists files whose names begin with `w`.
-Are some of these not working very well? Both man:locate[1] and man:whatis[1] depend on a database that is rebuilt weekly.
-If your machine is not going to be left on over the weekend (and running FreeBSD), you might want to run the commands for daily, weekly, and monthly maintenance now and then.
-Run them as `root` and, for now, give each one time to finish before you start the next one.
+Some of these commands rely on search databases.
+On FreeBSD these databases are updated automatically by periodic maintenance jobs.
+If they seem to return incomplete results, the databases may not have been updated yet.
+A system administrator can run these maintenance tasks manually as `root`:
[source,shell]
....
# periodic daily
-output omitted
# periodic weekly
-output omitted
# periodic monthly
-output omitted
....
-If you get tired of waiting, press kbd:[Alt+F2] to get another _virtual console_, and log in again.
-After all, it is a multi-user, multi-tasking system.
-Nevertheless these commands will probably flash messages on your screen while they are running; you can type `clear` at the prompt to clear the screen.
-Once they have run, you might want to look at [.filename]#/var/mail/root# and [.filename]#/var/log/messages#.
+These tasks are normally executed automatically by the system scheduler (cron).
+They update system databases, perform routine maintenance, and send status reports to the `root` account.
+
+If you are using the system console, you can switch to another virtual console with kbd:[Alt+F2] through kbd:[Alt+F8] and log in there while the commands run.
+
+Messages produced by maintenance jobs are usually mailed to the `root` account.
+They can be viewed in the local mailbox, for example:
-Running such commands is part of system administration-and as a single user of a UNIX(R) system, you are your own system administrator.
-Virtually everything you need to be `root` to do is system administration.
-Such responsibilities are not covered very well even in those big fat books on UNIX(R), which seem to devote a lot of space to pulling down menus in windows managers.
-You might want to get one of the two leading books on systems administration, either Evi Nemeth et.al.'s UNIX System Administration Handbook (Prentice-Hall, 1995, ISBN 0-13-15051-7)-the second edition with the red cover; or Æleen Frisch's Essential System Administration (O'Reilly & Associates, 2002, ISBN 0-596-00343-9).
-I used Nemeth.
+[.filename]#/var/mail/root#
+
+System messages are also recorded in log files such as:
+
+[.filename]#/var/log/messages#
+
+Running periodic maintenance tasks and reviewing their output is part of basic system administration.
+On a single-user system, you are effectively the system administrator.
+
+For more information about FreeBSD, see the extref:{handbook}[FreeBSD Handbook] and the manual pages installed with the system.
[[editing-text]]
== Editing Text
-To configure your system, you need to edit text files.
-Most of them will be in the [.filename]#/etc# directory; and you will need to `su` to `root` to be able to change them.
-You can use the easy `ee`, but in the long run the text editor `vi` is worth learning.
-There is an excellent tutorial on vi in [.filename]#/usr/src/contrib/nvi/docs/tutorial#, if you have the system sources installed.
+To configure your system, you will often need to edit text files.
+Many system configuration files are located in the [.filename]#/etc# directory.
+Changing these files usually requires administrative privileges, so you may need to become `root` using `su -` (or another privilege escalation tool such as man:sudo[8] or man:doas[1], if it is configured).
+
+FreeBSD includes the simple editor man:ee[1], which is easy for beginners to use.
+However, learning the text editor `vi` is worthwhile because it is available on almost all UNIX(R) systems.
+In the FreeBSD base system, `vi` is provided by the `nvi` editor.
+See man:vi[1] or the FreeBSD Handbook for more information.
-Before you edit a file, you should probably back it up.
+Additional text editors such as `nano`, `joe`, `vim`, or `neovim` are also available and can be installed using the FreeBSD package system:
+
+[source,shell]
+....
+# pkg install nano
+....
+
+Before editing a system file, it is a good idea to create a backup copy.
Suppose you want to edit [.filename]#/etc/rc.conf#.
-You could just use `cd /etc` to get to the [.filename]#/etc# directory and do:
+You could first change to the directory:
+
+[source,shell]
+....
+# cd /etc
+....
+
+Then create a backup:
[source,shell]
....
# cp rc.conf rc.conf.orig
....
-This would copy [.filename]#rc.conf# to [.filename]#rc.conf.orig#, and you could later copy [.filename]#rc.conf.orig# to [.filename]#rc.conf# to recover the original.
-But even better would be moving (renaming) and then copying back:
+This copies [.filename]#rc.conf# to [.filename]#rc.conf.orig#.
+If necessary, you can later restore the original version.
+
+Another method is to rename the original file and then copy it back:
[source,shell]
....
@@ -259,18 +294,18 @@
# cp rc.conf.orig rc.conf
....
-because `mv` preserves the original date and owner of the file.
+Because `mv` preserves the original timestamp and ownership, this method keeps the backup identical to the original file.
+
You can now edit [.filename]#rc.conf#.
-If you want the original back, you would then `mv rc.conf rc.conf.myedit` (assuming you want to preserve your edited version) and then
+If you want to restore the original file later, you could first save your edited version:
[source,shell]
....
+# mv rc.conf rc.conf.myedit
# mv rc.conf.orig rc.conf
....
-to put things back the way they were.
-
-To edit a file, type
+To edit a file, type:
[source,shell]
....
@@ -278,206 +313,347 @@
....
Move through the text with the arrow keys.
-kbd:[Esc] (the escape key) puts `vi` in command mode.
-Here are some commands:
+kbd:[Esc] (the Escape key) puts `vi` into command mode.
+
+Some useful commands:
`x`::
-delete letter the cursor is on
+delete the character under the cursor
`dd`::
-delete the entire line (even if it wraps on the screen)
+delete the entire line
`i`::
-insert text at the cursor
+insert text at the cursor position
`a`::
insert text after the cursor
-Once you type `i` or `a`, you can enter text.
-`Esc` puts you back in command mode where you can type
+After typing `i` or `a`, you can enter text.
+Press kbd:[Esc] to return to command mode.
+
+In command mode you can type:
`:w`::
-to write your changes to disk and continue editing
+write changes to disk and continue editing
`:wq`::
-to write and quit
+write changes and quit
`:q!`::
-to quit without saving changes
+quit without saving changes
`/_text_`::
-to move the cursor to _text_; `/` kbd:[Enter] (the enter key) to find the next instance of _text_.
+search forward for _text_; press kbd:[Enter] to repeat the search
`G`::
-to go to the end of the file
+go to the end of the file
`nG`::
-to go to line _n_ in the file, where _n_ is a number
+go to line _n_
kbd:[Ctrl+L]::
-to redraw the screen
+redraw the screen
kbd:[Ctrl+b] and kbd:[Ctrl+f]::
-go back and forward a screen, as they do with `more` and `view`.
+move backward or forward one screen, similar to `more` or `view`.
-Practice with `vi` in your home directory by creating a new file with `vi _filename_` and adding and deleting text, saving the file, and calling it up again.
-`vi` delivers some surprises because it is really quite complex, and sometimes you will inadvertently issue a command that will do something you do not expect.
-(Some people actually like `vi`-it is more powerful than DOS EDIT-find out about `:r`.)
-Use kbd:[Esc] one or more times to be sure you are in command mode and proceed from there when it gives you trouble, save often with `:w`, and use `:q!` to get out and start over (from your last `:w`) when you need to.
+Practice using `vi` in your home directory by creating a test file with `vi _filename_`, adding and deleting text, saving it, and reopening it.
+
+`vi` is a powerful editor and can sometimes behave in unexpected ways if commands are entered accidentally.
+If something goes wrong, press kbd:[Esc] several times to return to command mode.
+Save often with `:w`, and use `:q!` to quit without saving if necessary.
+
+Now you can `cd` to [.filename]#/etc#, become `root`, edit configuration files such as [.filename]#/etc/group#, and add a user to `wheel` so the user has root privileges. Just add a comma and the user’s login name to the end of the first line in the file, press Esc, and use :wq to write the file to disk and quit. Instantly effective. (You did not put a space after the comma, did you?)
+
+[NOTE]
+====
+Some administrative tasks are better performed using dedicated system tools instead of editing files manually.
+For example, to add a user to the `wheel` group:
-Now you can `cd` to [.filename]#/etc#, `su` to `root`, use `vi` to edit the file [.filename]#/etc/group#, and add a user to `wheel` so the user has root privileges.
-Just add a comma and the user's login name to the end of the first line in the file, press kbd:[Esc], and use `:wq` to write the file to disk and quit.
-Instantly effective. (You did not put a space after the comma, did you?)
+[source,shell]
+....
+# pw groupmod wheel -m username
+....
+====
[[other-useful-commands]]
== Other Useful Commands
`df`::
-shows file space and mounted systems.
+Shows disk usage and currently mounted filesystems.
`ps aux`::
-shows processes running. `ps ax` is a narrower form.
+Shows the processes currently running on the system. `ps ax` displays a shorter listing.
+
+`top`::
+Displays a continuously updated view of running processes and system resource usage.
`rm _filename_`::
-remove _filename_.
+Removes _filename_.
`rm -R _dir_`::
-removes a directory _dir_ and all subdirectories-careful!
+Removes the directory _dir_ and all of its contents. Use with care.
`ls -R`::
-lists files in the current directory and all subdirectories; I used a variant, `ls -AFR > where.txt`, to get a list of all the files in [.filename]#/# and (separately) [.filename]#/usr# before I found better ways to find files.
+Lists files in the current directory and all subdirectories. This can be useful for getting an overview of a directory tree.
+Changes a user's password (or `root`'s password when run by the superuser).
`man hier`::
-manual page on the UNIX(R) filesystem
+Describes the standard UNIX(R) filesystem hierarchy used by FreeBSD.
-Use `find` to locate [.filename]#filename# in [.filename]#/usr# or any of its subdirectories with
+`freebsd-version`::
+Displays the version of FreeBSD currently running on the system.
+
+Use man:find[1] to locate [.filename]#filename# in [.filename]#/usr# or any of its subdirectories:
[source,shell]
....
% find /usr -name "filename"
....
-You can use * as a wildcard in `"_filename_"` (which should be in quotes).
-If you tell `find` to search in [.filename]#/# instead of [.filename]#/usr# it will look for the file(s) on all mounted filesystems, including the CDROM and the DOS partition.
+You can use `*` as a wildcard in `"filename"` (which should be quoted).
+If you tell `find` to search in [.filename]#/# instead of [.filename]#/usr#, it will search all mounted filesystems.
+
+The `find` command is very powerful and can perform many types of searches.
+See man:find[1] for more information.
+
+There are many resources available for learning UNIX(R) commands and utilities.
+In addition to manual pages, the FreeBSD Handbook and other online documentation provide extensive information.
+
+=== Managing Services
+
+FreeBSD uses the rc.d system to manage system services.
-An excellent book that explains UNIX(R) commands and utilities is Abrahams & Larson, Unix for the Impatient (2nd ed., Addison-Wesley, 1996). There is also a lot of UNIX(R) information on the Internet.
+You can start or stop a service using the `service` command:
+
+[source,shell]
+....
+# service sshd start
+# service sshd stop
+# service sshd status
+....
+
+To enable a service at system startup, use `sysrc` to modify [.filename]#/etc/rc.conf#:
+
+[source,shell]
+....
+# sysrc sshd_enable="YES"
+....
+
+See man:service[8] and man:sysrc[8] for more information.
+
+== ZFS Basics
+
+Most modern FreeBSD installations use the ZFS filesystem.
+
+You can view the available ZFS datasets with:
+
+[source,shell]
+....
+% zfs list
+....
+
+ZFS also supports snapshots, which allow you to preserve the state of a filesystem at a particular point in time:
+
+[source,shell]
+....
+# zfs snapshot zroot/home@before-edit
+....
+
+See extref:{handbook}zfs[ZFS chapter in FreeBSD Handbook] or man:zfs[8] for more information.
[[next-steps]]
== Next Steps
-You should now have the tools you need to get around and edit files, so you can get everything up and running.
-There is a great deal of information in the FreeBSD handbook (which is probably on your hard drive) and link:https://www.FreeBSD.org/[FreeBSD's web site].
-A wide variety of packages and ports are on the CDROM as well as the web site.
-The handbook tells you more about how to use them (get the package if it exists, with `pkg add _packagename_`, where _packagename_ is the filename of the package).
-The CDROM has lists of the packages and ports with brief descriptions in [.filename]#cdrom/packages/index#, [.filename]#cdrom/packages/index.txt#, and [.filename]#cdrom/ports/index#, with fuller descriptions in [.filename]#/cdrom/ports/\*/*/pkg/DESCR#, where the *s represent subdirectories of kinds of programs and program names respectively.
+You should now have the basic tools needed to navigate the system and edit files.
+
+To install additional software, FreeBSD provides the `pkg` package manager.
+It downloads and installs prebuilt software from the official repositories.
-If you find the handbook too sophisticated (what with `lndir` and all) on installing ports from the CDROM, here is what usually works:
+For example, to install the `git` version control system:
-Find the port you want, say `kermit`. There will be a directory for it on the CDROM.
-Copy the subdirectory to [.filename]#/usr/local# (a good place for software you add that should be available to all users) with:
+[source,shell]
+....
+# pkg install git
+....
+
+You can search for available software with:
[source,shell]
....
-# cp -R /cdrom/ports/comm/kermit /usr/local
+% pkg search text
....
-This should result in a [.filename]#/usr/local/kermit# subdirectory that has all the files that the `kermit` subdirectory on the CDROM has.
+where _text_ is part of the package name or description.
+
+=== Updating the Base System
-Next, create the directory [.filename]#/usr/ports/distfiles# if it does not already exist using `mkdir`.
-Now check [.filename]#/cdrom/ports/distfiles# for a file with a name that indicates it is the port you want.
-Copy that file to [.filename]#/usr/ports/distfiles#; in recent versions you can skip this step, as FreeBSD will do it for you.
-In the case of `kermit`, there is no distfile.
+FreeBSD provides the man:freebsd-update[8] utility to update the base operating system.
-Then `cd` to the subdirectory of [.filename]#/usr/local/kermit# that has the file [.filename]#Makefile#.
-Type
+To fetch and install security updates:
[source,shell]
....
-# make all install
+# freebsd-update fetch
+# freebsd-update install
....
-During this process the port will FTP to get any compressed files it needs that it did not find on the CDROM or in [.filename]#/usr/ports/distfiles#.
-If you do not have your network running yet and there was no file for the port in [.filename]#/cdrom/ports/distfiles#, you will have to get the distfile using another machine and copy it to [.filename]#/usr/ports/distfiles#.
-Read [.filename]#Makefile# (with `cat` or `more` or `view`) to find out where to go (the master distribution site) to get the file and what its name is.
-(Use binary file transfers!) Then go back to [.filename]#/usr/local/kermit#, find the directory with [.filename]#Makefile#, and type `make all install`.
+You can also check installed packages for known security vulnerabilities:
+
+[source,shell]
+....
+# pkg audit
+....
+
+For more advanced installation methods, including building software from the FreeBSD Ports Collection, see the
+extref:{handbook}ports[ Packages and Ports in FreeBSD Handbook].
[[your-working-environment]]
== Your Working Environment
Your shell is the most important part of your working environment.
-The shell is what interprets the commands you type on the command line, and thus communicates with the rest of the operating system.
-You can also write shell scripts a series of commands to be run without intervention.
+The shell interprets the commands you type on the command line and communicates with the rest of the operating system.
+You can also write shell scripts, which are sequences of commands executed automatically.
+
+Two shells are included in the FreeBSD base system: man:sh[1] and man:tcsh[1].
+`sh` is the standard POSIX shell used for system scripts and administrative tasks.
+`tcsh` is an enhanced interactive shell that provides convenient features for command-line work.
+
+You can find out which shell you are using by typing:
+
+[source,shell]
+....
+% echo $SHELL
+....
+
+The `tcsh` shell provides several features that make interactive use easier.
+It allows you to recall previous commands with the arrow keys and edit them.
+It also supports tab completion for file names and commands, and lets you quickly switch to the previous directory with `cd -`.
+
+
+When `tcsh` starts, it reads several configuration files.
+System-wide settings are read from [.filename]#/etc/csh.cshrc# and [.filename]#/etc/csh.login#.
+User-specific settings are usually placed in [.filename]#.cshrc# and [.filename]#.login# in the user's home directory.
+
+You can customize the command prompt in [.filename]#.cshrc#.
+For example:
+
+[source,shell]
+....
+set prompt = "%h %t %~ %# "
+....
+
+This prompt displays the command history number, the current time, and the current directory.
+It also shows `>` for an ordinary user and `#` for `root`.
+
+After editing the file, you can reload it without logging out by typing:
+
+[source,shell]
+....
+% source ~/.cshrc
+....
+
+You can view the environment variables currently set in your session by typing:
+
+[source,shell]
+....
+% env
+....
+
+This will display values such as the default editor, pager, and terminal type.
-Two shells come installed with FreeBSD: `csh` and `sh`.
-`csh` is good for command-line work, but scripts should be written with `sh` (or `bash`).
-You can find out what shell you have by typing `echo $SHELL`.
+If you log in remotely and encounter problems with terminal compatibility, you may need to set the terminal type manually, for example:
+
+[source,shell]
+....
+% setenv TERM vt100
+....
-The `csh` shell is okay, but `tcsh` does everything `csh` does and more.
-It allows you to recall commands with the arrow keys and edit them.
-It has tab-key completion of filenames (`csh` uses kbd:[Esc]), and it lets you switch to the directory you were last in with `cd -`.
-It is also much easier to alter your prompt with `tcsh`.
-It makes life a lot easier.
+If you prefer a different shell, several popular alternatives are available in the FreeBSD package repository, including `bash`, `zsh`, and `fish`.
-Here are the three steps for installing a new shell:
+Here are the steps for installing and using another shell:
[.procedure]
====
-. Install the shell as a port or a package, just as you would any other port or package.
-. Use `chsh` to change your shell to `tcsh` permanently, or type `tcsh` at the prompt to change your shell without logging in again.
+. Install the shell using the package manager. For example:
+
++
+[source,shell]
+....
+# pkg install zsh
+....
+
+. Change your login shell using `chsh`:
+
++
+[source,shell]
+....
+% chsh -s /usr/local/bin/zsh
+....
+
+. Log out and log in again for the change to take effect.
====
[NOTE]
====
-It can be dangerous to change `root`'s shell to something other than `sh` or `csh` on early versions of FreeBSD and many other versions of UNIX(R);
-you may not have a working shell when the system puts you into single user mode.
-The solution is to use `su -m` to become `root`, which will give you the `tcsh` as `root`, because the shell is part of the environment.
-You can make this permanent by adding it to your [.filename]#.tcshrc# as an alias with:
+For reliability, it is usually best to keep `root`'s login shell as `/bin/sh`.
+This ensures that a working shell is always available in single-user mode if the system needs recovery.
+If you prefer to use another shell temporarily while working as `root`, you can use `su` after logging in as a regular user.
+====
-[.programlisting]
+
+[[other]]
+== Other
+
+As `root`, you can mount removable storage such as a USB flash drive.
+
+When you insert a USB device, the system will detect it automatically.
+You can check the device name by looking at recent kernel messages:
+
+[source,shell]
....
-alias su su -m
+% dmesg | tail
....
-====
+A USB flash drive will typically appear as a device such as `/dev/da0`.
+If the device contains a standard FAT or exFAT filesystem, you can mount it with:
-When `tcsh` starts up, it will read the [.filename]#/etc/csh.cshrc# and [.filename]#/etc/csh.login# files, as does `csh`.
-It will also read [.filename]#.login# in your home directory and [.filename]#.cshrc# as well, unless you provide a [.filename]#.tcshrc#.
-This you can do by simply copying [.filename]#.cshrc# to [.filename]#.tcshrc#.
+[source,shell]
+....
+# mount -t msdosfs /dev/da0s1 /mnt
+....
-Now that you have installed `tcsh`, you can adjust your prompt.
-You can find the details in the manual page for `tcsh`, but here is a line to put in your [.filename]#.tcshrc# that will tell you how many commands you have typed, what time it is, and what directory you are in.
-It also produces a `>` if you are an ordinary user and a # if you are `root`, but tsch will do that in any case:
+After mounting, the files on the flash drive will be available under the directory [.filename]#/mnt#.
+You can list them with:
-set prompt = "%h %t %~ %# "
-
-This should go in the same place as the existing set prompt line if there is one, or under "if($?prompt) then" if not.
-Comment out the old line; you can always switch back to it if you prefer it.
-Do not forget the spaces and quotes.
-You can get the [.filename]#.tcshrc# reread by typing `source .tcshrc`.
+[source,shell]
+....
+% ls /mnt
+....
-You can get a listing of other environmental variables that have been set by typing `env` at the prompt.
-The result will show you your default editor, pager, and terminal type, among possibly many others.
-A useful command if you log in from a remote location and cannot run a program because the terminal is not capable is `setenv TERM vt100`.
+When you are finished using the device, unmount it before removing it:
-[[other]]
-== Other
+[source,shell]
+....
+# umount /mnt
+....
-As `root`, you can unmount the CDROM with `/sbin/umount /cdrom`, take it out of the drive, insert another one, and mount it with `/sbin/mount_cd9660 /dev/cd0a /cdrom` assuming cd0a is the device name for your CDROM drive.
-The most recent versions of FreeBSD let you mount the CDROM with just `/sbin/mount /cdrom`.
+Removing a device without unmounting it first may cause data loss.
-Using the live filesystem-the second of FreeBSD's CDROM disks-is useful if you have got limited space.
-What is on the live filesystem varies from release to release.
-You might try playing games from the CDROM.
-This involves using `lndir`, which gets installed with the X Window System, to tell the program(s) where to find the necessary files, because they are in [.filename]#/cdrom# instead of in [.filename]#/usr# and its subdirectories, which is where they are expected to be.
-Read `man lndir`.
+== References
+* extref:{handbook}security[Shared administration with `doas`, security-doas]
+* extref:{handbook}security[Shared administration with `sudo`, security-sudo]
+* extref:{handbook}basics[Adding a user, users-adduser]
+* extref:{handbook}basics[Removing a user, users-rmuser]
-If you use this guide I would be interested in knowing where it was unclear and what was left out that you think should be included, and if it was helpful.
-My thanks to Eugene W. Stark, professor of computer science at SUNY-Stony Brook, and John Fieber for helpful comments.
+This guide was originally written by Annelise Anderson and has been updated over time by the FreeBSD community.