FreeBSD tips

Some tips I collected about FreeBSD.

Uninstalling a program

You can go into the ports, and uninstall it manually :

Or you can use pkg_delete. It does not matter if you have installed a port or a package, as the final result is the same. It will also remove dependencies. However, you must either specify the application version or use wildcards :

Another solution is to use pkg_rmleaves. It will present a ncurses windows, in which you will only have to select your application. Do not forget to install this utility first, in ports-mgmt/pkg_rmleaves.

New terminal in the same folder

Useful for windows manager (openbox, wmii…) where there is no tab support in the terminals. Create another instance of the terminal :

Take a screen shot Use the scrot functionnality with a delay, for example 5 seconds :

Git colors

It is most likely you will not have colors on Git, for example in the log. This comes from a pager issue and can be corrected by placing the following in .git/config

Extract useful information from /usr/ports/UPDATING

You can use pkg_updating as described here.

Updating locate database

A very useful utility for finding quickly a file is locate. You will need to keep its database though. For that, see the following link.

Running Linux in Virtualbox from FreeBSD

First, you will need to install Virtualbox on FreeBSD and start it with Virtualbox. Then you have to install addition on the guest OS. Look in the Virtualbox menu, at Install additions. Now run:

If you have shared folders, mount -t vboxfs does not work. So you must mount them with (on Linux) :

Your folder will be available at folderlocation.

FatRat build error

If you have the following error while building the application

Then you only need to replace SA_NOMASK by SA_NODEFER.