FreeBSD
Install Media Creation
Download one of the .img files from https://www.freebsd.org/where.html
Install Documentation: https://www.freebsd.org/doc/handbook/bsdinstall-pre.html
# dd to raw disk, not partition # (same 'dd' params on bsd and linux) dd if=FreeBSD-10.2-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=syncInstallation can also be scripted using the FreeBSD bsdinstall commandline tool.
Release Management
Updates from FreeBSD version (ex: 11.1 -> 11.2) are possible. See freebsd release management.
Package Management
Important Package Locations /usr/local/share/
Typical Package install location /etc/rc.d
/usr/local/etc/rc.d
Init script locations (find out what variables to use in rc.conf here) http://pkg.FreeBSD.org/FreeBSD:12:amd64/quarterly/All packages downloaded from here FreeBSD has three methods of installing programs. Ports, pkg_add, and pkg.
- Ports are the source code and makefiles, which must be compiled.
- Pkg_add are precompiled binaries.
- pkg, or PackageNG are also precompiled binaries, but they have \
been compiled from the ports tree. This is the preferred method of\ package management.
pkgng freebsd-ports Freebsd still supports pkg_add, but it's main package manager is pkgng.
Kernel Sourcecode
# Fetch kernel sourcecode, extract to /usr/src fetch -o /tmp ftp://ftp.freebsd.org/pub/`uname -s`/releases/`uname -m`/`uname -r | cut -d'-' -f1,2`/src.txz tar -C / -xvf /tmp/src.txz
Kernel Modules
/boot/kernel/
Kernel Module Location sudo kldload fuse ## Load a kernel module (by name) sudo kldstat ## Show all loaded kernel modules# /boot/loader.conf # this file contains all kernel-modules to be started on boot fuse_load="YES"
FileSystem
BSD FileSystem FreeBSD devfs Volume Management
camcontrol devlist # lists diskname/device (ada0, da0, ..) gpart show /dev/ada0 # list partition table ls /dev/disk/ # lists available disks/partitions ls /dev/diskid/ # lists disks by id
Create new UFSgpart destroy -F da1 ## delete MBG/gpt gpart create -s gpt da1 ## create GPT partition system. gpart add -t freebsd-ufs da1 ## create partition covering entire disk newfs -U /dev/da1s1 ## new ufs filesystem df -h /dev/da1s1 ## confirm size of filesystem is appropriateMount ZFS
zpool import -fR /mnt -a ## mount a zpool to /mntMount ext2/3/4
# see: https://www.freebsd.org/doc/handbook/filesystems-linux.html # requires port: sysutils/fusefs-ext2fs kldload ext2fs mount -t ext2fs /dev/ad1s1 /mntMount exfat
# requires port: sysutils/fusefs-exfat mount -t exfat /dev/ad1s1 /mntMount fat32
sudo mount -t msdosfs /dev/da0p1 /mnt
Init/Services System
See FreeBSD-init.
Startup/Shutdown
shutdown -p now reboot
Date/Time
## Query Date date ## prints current date/time ## Timezone ln -s /usr/share/zoneinfo/America/Toronto /etc/localtime ## Sync Current Time ntpdate -v -b in.pool.ntp.org ## set current date with ntp
Networking
See freebsd networking.
start/stop/restart network
# restart network service netif restart service routing restart # connect to network dhclient en01Static IP
# /etc/rc.conf hostname="groot" defaultrouter="192.168.1.1" ifconfig_em0="inet 192.168.1.220/24" # replace em0 with your netwk interface# /etc/resolv.conf nameserver 192.168.1.1IP Aliases (for VMs)
# /etc/rc.conf ifconfig_em0_alias0="192.168.1.221/24" ifconfig_em0_alias1="192.168.1.222/24" ...Manual DHCP Connection
... dhclient em0
TTY
FreeBSD currently uses freebsd vt as a console driver.
For historical drivers, see tty.
Firewall
See pf.
Containers
FreeBSD jails
Linux Emulation
See FreeBSD linuxlator .
Resource Management
Documentation
memory https://wiki.freebsd.org/Memory virtual memory https://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/vm.html CPU
bsd top Memory
freebsd procfs bsd ps bsd top procstat bsd vmstat Network
tcpdump pflog sockstat netstat
Backups & Restoration
freebsd dump