cvs_id = '$Id: freebsd-tips.php,v 1.19 2004/08/28 20:42:53 simon Exp $'; $hhf->title = "FreeBSD tips"; $hhf->print_header(); ?> This page contains misc. FreeBSD tips that might be useful.. they are for me :)
It is still very much work in progress...
Use these tips at your own responsibility.

Misc short tips

install /usr/ports/sysutils/portupgrade/

FreshPorts a nice site to stay up to date with your ports :)

Danish BSD FAQ

Nice stuff for /etc/make.conf

# 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 Danish mirrors first, then Swedish and finally Norwegian.
MASTER_SORT_REGEX?=     ^file: ^ftp://ftp\.FreeBSD\.org/pub/FreeBSD/ports/local-distfiles/ ://[^/]*\.dk/ ://[^/]*\.se ://[^/]*\.no\.

# 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

Update ports

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

Get Danish characters

It can be done in (at least) two ways :

Note: You might need to login again / restart X to make the change active.

Per user

Add to ~/.login_conf :
me:\
        :charset=iso-8859-1:\
        :lang=da_DK.ISO8859-1:

System wide

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

English program texts

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

sudo (/usr/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'

Serial console

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.

Get FreeBSD version of /usr/src

grep -E 'BRANCH|REVISION' /usr/src/sys/conf/newvers.sh

NTP

A list of danish/nordic NTP servers : More can be found at http://www.eecis.udel.edu/~mills/ntp/servers.html

Count the total size of a ls -l output

cat /tmp/1 | awk 'BEGIN{c=0} {c+=$2; print $2} END{print "Sum = ", c, "B", c/1024/1024/1024, "GB"}'

Make gdb stop paging

set height 0

Make gdb display full strings

set print elements 0
Main homepage
print_footer(); ?>