5
votes

For completeness, similar to Hidden Features of Linux and Hidden Features of Solaris/OpenSolaris, what are the hidden features of FreeBSD?

2
  • 3
    Nothing is hidden in FreeBSD, nor in any other open source OS for that matter.
    – Karolis T.
    Jun 26, 2009 at 10:34
  • @Karolis you are misinterpreting hidden Jun 27, 2009 at 1:03

9 Answers 9

8
votes

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!

5
votes

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.

1
  • man.cgi is rather nice Jul 17, 2009 at 7:53
4
votes

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.

1
  • Definitely Jails, though I am a bit surprised this is considered 'hidden'. Jun 26, 2009 at 22:06
4
votes

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. See man 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 (like sshd) 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-specific rc 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 with mdconfig.
  • In /etc/fstab, if you configure the mount type (fourth field) as xx, 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 with passwd_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 and nomakeoptions. 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 and portupgrade 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 for dd.
  • 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 and wget.

Edited to fix orphaned kernel config, and minor grammar.

3
votes

sysctl and everything you can change with that mechanism.

2
  • What is the difference with Linux sysctl?
    – wazoox
    Jun 26, 2009 at 9:36
  • 1
    sysctl 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, 2009 at 14:04
3
votes

DTrace, because it is rather new to the system

3
votes
% 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
2
votes

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.

0
votes

Not hidden (they are quite common), but critical for basic FreeBSD use:

  • uname -aar
  • portsnap fetch; porstnap extract

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .