Virtual Consoles and Terminals:
The key combinations Alt+F1 through Alt+F8 have been reserved by FreeBSD for switching between virtual consoles. Use Alt+F1 to switch to the system console (ttyv0), Alt+F2 to access the first virtual console (ttyv1), Alt+F3 to access the second virtual console (ttyv2), and so on.
Refer to kbdcontrol(1), vidcontrol(1), atkbd(4), syscons(4), and vt(4) for a more technical description of the FreeBSD console and its keyboard drivers.

Changing Console Video Modes:
    The FreeBSD console default video mode may be adjusted to 1024x768, 1280x1024, or any other size supported by the graphics chip and monitor. 
    To use a different video mode load the VESA module:        kldload vesa
    To select a new video mode, specify the mode using vidcontrol(1) as the root user:    vidcontrol MODE_279
    If the new video mode is acceptable, it can be permanently set on boot by adding it to /etc/rc.conf:    allscreens_flags="MODE_279"

Table 3.1. Utilities for Managing User Accounts
Command Summary
adduser(8) The recommended command-line application for adding new users.
rmuser(8) The recommended command-line application for removing users.
chpass(1) A flexible tool for changing user database information.
passwd(1) The command-line tool to change user passwords.
pw(8) A powerful and flexible tool for modifying all aspects of user accounts.

(permissions) t Sticky bit
(permissions) s Set UID or GID

3.4.2. FreeBSD File Flags:
    In addition to file permissions, FreeBSD supports the use of “file flags”. These flags add an additional level of security and control over files, but not directories. With file flags, even root can be prevented from removing or altering files.
    chflags sunlink file1 ;        chflags nosunlink file1;        ls -lo file1 ;

The setuid, setgid, and sticky Permissions:
    To understand them, the difference between the real user ID and effective user ID must be noted.
    The setuid permission may be set by prefixing a permission set with the number four (4) as shown in the following example:        chmod 4755
    The permissions on now look like the following:    -rwsr-xr-x   1 trhodes  trhodes    63 Aug 29 06:36
    Note that a s is now part of the permission set designated for the file owner, replacing the executable bit. 

    The setgid permission performs the same function as the setuid permission; 
    To set the setgid permission on a file, provide chmod(1) with a leading two (2):    chmod 2755
    In the following listing, notice that the s is now in the field designated for the group permission settings: -rwxr-sr-x   1 trhodes  trhodes    44 Aug 31 01:49

    The setuid and setgid permission bits may lower system security, by allowing for elevated permissions. The third special permission, the sticky bit, can strengthen the security of a system.
    When the sticky bit is set on a directory, it allows file deletion only by the file owner.
    To utilize this permission, prefix the permission set with a one (1):# chmod 1777 /tmp
    The sticky bit permission will display as a t at the very end of the permission set:    ls -al / | grep tmp    ; drwxrwxrwt  10 root  wheel         512 Aug 31 01:49 tmp

Directory Structure:
Directory Description
/ Root directory of the file system.
/bin/ User utilities fundamental to both single-user and multi-user environments.
/boot/ Programs and configuration files used during operating system bootstrap.
/boot/defaults/ Default boot configuration files. Refer to loader.conf(5) for details.
/dev/ Device nodes. Refer to intro(4) for details.
/etc/ System configuration files and scripts.
/etc/defaults/ Default system configuration files. Refer to rc(8) for details.
/etc/mail/ Configuration files for mail transport agents such as sendmail(8).
/etc/namedb/ named(8) configuration files.
/etc/periodic/ Scripts that run daily, weekly, and monthly, via cron(8). Refer to periodic(8) for details.
/etc/ppp/ ppp(8) configuration files.
/mnt/ Empty directory commonly used by system administrators as a temporary mount point.
/proc/ Process file system. Refer to procfs(5), mount_procfs(8) for details.
/rescue/ Statically linked programs for emergency recovery as described in rescue(8).
/root/ Home directory for the root account.
/sbin/ System programs and administration utilities fundamental to both single-user and multi-user environments.
/tmp/ Temporary files which are usually not preserved across a system reboot. A memory-based file system is often mounted at /tmp. This can be automated using the tmpmfs-related variables of rc.conf(5) or with an entry in /etc/fstab; refer to mdmfs(8) for details.
/usr/ The majority of user utilities and applications.
/usr/bin/ Common utilities, programming tools, and applications.
/usr/include/ Standard C include files.
/usr/lib/ Archive libraries.
/usr/libdata/ Miscellaneous utility data files.
/usr/libexec/ System daemons and system utilities executed by other programs.
/usr/local/ Local executables and libraries. Also used as the default destination for the FreeBSD ports framework. Within /usr/local, the general layout sketched out by hier(7) for /usr should be used. Exceptions are the man directory, which is directly under /usr/local rather than under /usr/local/share, and the ports documentation is in share/doc/port.
/usr/obj/ Architecture-specific target tree produced by building the /usr/src tree.
/usr/ports/ The FreeBSD Ports Collection (optional).
/usr/sbin/ System daemons and system utilities executed by users.
/usr/share/ Architecture-independent files.
/usr/src/ BSD and/or local source files.
/var/ Multi-purpose log, temporary, transient, and spool files. A memory-based file system is sometimes mounted at /var. This can be automated using the varmfs-related variables in rc.conf(5) or with an entry in /etc/fstab; refer to mdmfs(8) for details.
/var/log/ Miscellaneous system log files.
/var/mail/ User mailbox files.
/var/spool/ Miscellaneous printer and mail system spooling directories.
/var/tmp/ Temporary files which are usually preserved across a system reboot, unless /var is a memory-based file system.
/var/yp/ NIS maps.


A simple editor to learn is ee(1), which stands for easy editor.

A copy of the boot messages are saved to /var/run/dmesg.boot.

Manual Pages
If the name of the manual page is unknown, use man -k to search for keywords in the manual page descriptions: man -k mail

1 User commands.
2 System calls and error numbers.
3 Functions in the C libraries.
4 Device drivers.
5 File formats.
6 Games and other diversions.
7 Miscellaneous information.
8 System maintenance and operation commands.
9 System kernel interfaces.

In addition to manual pages, these programs may include hypertext documents called info files. 

Packages and Ports:


Building Packages with Poudriere:
    Configuring pkg Clients to Use a Poudriere Repository: vi:    /usr/local/etc/pkg/repos/FreeBSD.conf 
        FreeBSD: {
            enabled: no

        custom: {
            url: "",
            enabled: yes,

Most applications install at least one default configuration file in /usr/local/etc.
Applications which provide documentation will install it into /usr/local/share/doc.
Some applications run services which must be added to /etc/rc.conf before starting the application. These applications usually install a startup script in /usr/local/etc/rc.d
Use pkg info to determine which files, man pages, and binaries were installed with the application.

The X Window System:
X server , X client , window manager , desktop environment , focus policy , widgets ,

--Write by Marcustar,关关雎鸠,在河之洲
Download 相册