For completeness, similar to Hidden Features of Linux and Hidden Features of Solaris/OpenSolaris, what are the hidden features of FreeBSD?
-
3Nothing is hidden in FreeBSD, nor in any other open source OS for that matter. – Karolis T. Jun 26 '09 at 10:34
-
@Karolis you are misinterpreting hidden – Tim Matthews Jun 27 '09 at 01:03
9 Answers
I've accidentally found in the source of cp
command (FreeBSD 7.2); the SIGINFO
signal handler: if you press Ctrl+T while cp
is copying something huge, you will see (along with other info) the progress of the operation in percent!
- 2,319
- 5
- 23
- 24
- 231
- 1
- 3
Documentation! The manual pages, which lie midway between the brevity and vagueness that typifies Linux documentation, and the overtechnical detail of Solaris manpages. The handbook, which helps people who are new to systems administration, new to FreeBSD, or even new to Unix get started.
- 2,319
- 5
- 23
- 24
- 3,041
- 20
- 28
I'm surprised no one has mentioned jail yet. Very similar to zones in Solaris, jails offer a very convenient and secure way to isolate applications as well as creating virtual hosts.
An old one (these days) is the background fsck and filesystem snapshots.
I've always rather liked the various 'stat' commands and the way systat ties them alot of them together. It's a great addition to top. Linux doesn't seem to have the various collection of 'stat' commands that FreeBSD has.
Availability of three different packet filters to suit your preference -- ipfw, ipf, and OpenBSD's pf.
- 2,319
- 5
- 23
- 24
- 646
- 3
- 6
-
Definitely Jails, though I am a bit surprised this is considered 'hidden'. – Martin P. Hellwig Jun 26 '09 at 22:06
Here are a couple of basic ones from my tool bag. I left out the things that are common to multiple Unix-likes, but many of the Linux "hidden features" tips are also usable on FreeBSD.
I also tried to avoid saying things like "ZFS rocks." While I think that's true, it's not really very hidden. :-)
Console configuration:
- When on the local console of a vanilla system, if the keyboard is sloooow, you can use
kbdcontrol -r fast
to bump up your keyboard delay and repeat rate. - You can use the
/boot.config
file (yes, that's a file in the root of/
) to use both the serial port and the video/keyboard for console. Seeman boot(8)
. - The Alt-F[1-8] keys get you virtual consoles, and
lock -nvp
will let you lock them all down if you need to walk away for a bit. - Tapping Scroll Lock lets you use PageUp/PageDown to see previous screens that have rolled off the top of your monitor.
System administration:
- You can configure site-wide and box-specific versions of a number of configuration files using a
.local
suffix, most notably/boot/loader.conf.local
and/etc/rc.conf.local
. For example, things you enable on all systems (likesshd
) can go into/etc/rc.conf
, and local overrides (like interface configs, hostnames, local daemons, etc.) can go into/etc/rc.conf.local
. This is a simple way to let you push out side-wide changes without overwriting box-specificrc
stuff. It doesn't hold a candle to Puppet or its kin, but it's a lightweight way to do distributed configuration. - The full initial dmesg at boot time is always available in
/var/run/dmesg.boot
. top -mio
shows the top I/O talkers.- You don't have to be using ZFS to do filesystem snapshots - see
mksnap_ffs(8)
. Not as full-featured as ZFS, but a simple add-on to existing UFS filesystems. These snapshots can be mounted withmdconfig
. - In
/etc/fstab
, if you configure the mount type (fourth field) asxx
, that mount line is ignored - great for documenting fallow partitions. man hier
explains the filesystem layout at a high level.- Use
mdconfig
to mount ISOs. - You can use
/etc/login.conf
to change the default password hashing function to blowfish withpasswd_format:blf
. - If you're rolling your own kernel, you can create your kernel config by including an existing kernel config by reference, and then just adding the differences. You can also override inherited items with
nooptions
,nodevice
andnomakeoptions
. For example, here's how to make a kernel that includes all of GENERIC, but simply adds some debugging options and a few tweaks (and this is the entire file):
include GENERIC ident DEBUG-GENERIC options KDB options DDB nooptions COMPAT_FREEBSD4 nooptions COMPAT_FREEBSD5 nooptions COMPAT_FREEBSD6 # This is actually the default; just an example. makeoptions DEBUG=-g nodevice atkbdc nodevice atkbd nodevice psm
Ports management and software:
portinstall
andportupgrade
have a-c
option that asks you all of those port configuration questions before the downloads and installs begin - a major time-saver.- You can report on all ports with known security issues with
security/portaudit
. It also adds its own report to the daily security output. - If you have to override enforcement of security for the installation of a specific port (hopefully only for internal or temporary use!) you can
export DISABLE_VULNERABILITIES=yes
. portsclean -D
removes all distfiles not referenced by any active ports.ports-mgmt/portdowngrade
lets you downgrade to a specific version of a port - very handy if you find out that your upgrade broke something important. It requires exporting the ANONCVS environment variable first, containing the CVS URL (which I always forget and have to go look up).- You can use
ports-mgmt/pkg_cutleaves
to prune packages that have no other dependencies. Use/usr/local/etc/pkg_leaves.exclude
to keep a list of packages that you always want to keep, but that no other packages depend on. - Linux binary compatibility.
- If you're running a server, add
WITHOUT_X11=yes
to/etc/make.conf
to automatically skip X for most (well-behaved) ports. - @Henry Flower's note about sending SIGINFO to
cp
for progress information also works fordd
. - My on-every-box port list includes
arping
,bash
,coreutils
,dmidecode
,dnstop
,lsof
,mcelog
,multitail
(very powerful),portaudit
,portdowngrade
,portupgrade
,pstree
,rsync
,screen
,smartmontools
,strace
,sudo
,vim
andwget
.
Edited to fix orphaned kernel config, and minor grammar.
- 1,362
- 8
- 16
sysctl
and everything you can change with that mechanism.
- 6,749
- 3
- 29
- 26
-
-
1sysctl in the BSD world is the big stick when it comes to modifying the behavior of a running system. Linux does have sysctl, but its more like an interface into the /proc system. I guess it comes down to consistency, freeBSD _expects_ you to use sysctl for a whole class of issues and linux offers it as an option along with several other tools. – D.F. Jun 26 '09 at 14:04
% grep -A4 JOKE /usr/src/usr.bin/make/job.c #ifndef WITHOUT_OLD_JOKE if (strcmp(gn->name,"love") == 0) (*abortProc)("Not war."); else #endif % make love Not war. Exit 2
- 231
- 1
- 3
Simplicity and control - a base BSD installation is much leaner than a typical Linux distribution. See this posting for a back of envelope comparison of *BSD against other operating systems.
- 8,810
- 2
- 31
- 52
Not hidden (they are quite common), but critical for basic FreeBSD use:
- uname -aar
- portsnap fetch; porstnap extract
- 121
- 4