This page contains miscellaneous FreeBSD tips that might be useful. Please see the official FreeBSD Documentation for more information.
Use these tips at your own responsibility.
Install and use sysutils/portupgrade/ to keep your ports up-to-date.
FreshPorts a nice site to get information about FreeBSD ports.
# Start by downloading from a Danish mirror
MASTER_SITE_BACKUP?= \
ftp://ftp.dk.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/
# Make FreeBSD start getting distfiles (source for ports) from local
# freebsd mirror
MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}
# Try mirrors close to Denmark first.
MASTER_SORT?= .dk sunet.se .se dk.php.net .no .de mirrorservice.org \
.uk .at heanet.dl.sourceforge.net .nl
# Make it possible to update source and ports by just running make update
# in /usr/src and /usr/ports
SUP_UPDATE= yes
SUP= /usr/local/bin/cvsup
SUPFLAGS= -g -L 2
SUPHOST= cvsup.dk.freebsd.org # Change to your local cvsup mirror
SUPFILE= /usr/share/examples/cvsup/standard-supfile
PORTSSUPFILE= /usr/share/examples/cvsup/ports-supfile
# For servers, tell ports not to compile X11 support if possible
WITHOUT_X11= yes
Quick command for update of local ports collection (wont update the programs just the ports collection in /usr/ports).
cvsup -L 2 -g -h cvsup.dk.freebsd.org /usr/share/examples/cvsup/ports-supfile
Note: If you don not have cvsup installed, it can be installed with:
pkg_add -r cvsup-without-gui
It can be done in (at least) two ways :
Note: You might need to login again / restart X to make the change active.
Add to ~/.login_conf:
me:\
:charset=iso-8859-1:\
:lang=da_DK.ISO8859-1:
Add to /etc/login.conf:
danish:Danish Users Accounts:\
:charset=ISO-8859-1:\
:lang=da_DK.ISO8859-1:\
:tc=default:
Run:
cap_mkdb /etc/login.conf pw usermod <your username> -L danish
If you dont want your programs to start using Danish add the following to your ~/.tcshrc:
setenv LC_MESSAGES en_US.ISO8859-1
or if you use bash add the following to your ~/.bashrc:
LC_MESSAGES=en_US.ISO8859-1; export LC_MESSAGES
Note: For some older versions of FreeBSD it might be needed to use da_DK.ISO_8859-1 instead of da_DK.ISO8859-1.
sudo (ports/security/sudo/) is a nice program to run root only things as non root users. Here are some lines from my sudoers (the sudo config) file:
simon ALL=NOPASSWD:/sbin/mount /mnt/cdrom,/sbin/umount /mnt/cdrom simon ALL=NOPASSWD:/usr/sbin/cdcontrol -f /dev/acd0c eject
This can be used with the following lines in your ~/.tcshrc file to make it really easy:
alias mntcd 'sudo mount /mnt/cdrom' alias umntcd 'sudo umount /mnt/cdrom' alias ejectcd 'sudo cdcontrol -f /dev/acd0c eject'
To force serial console put -H in /boot.config, or to only use serial console if no keyboard is pressent when booting, put -P in /boot.config.
grep -E 'BRANCH|REVISION' /usr/src/sys/conf/newvers.sh
cat /tmp/1 | awk 'BEGIN{c=0} {c+=$2; print $2} END{print "Sum = ", c, "B", c/1024/1024/1024, "GB"}'
set height 0
set print elements 0
set print pretty on