»   »   »

FreeBSD Howto's


This is a collection of questions I had on FreeBSD, as I discovered answers I added them here; the list is small, but growing. Many of the commands I use in Linux (documented here) can be used with FreeBSD too.

How Do I...?

Scroll up in a terminal : Press Scroll-Lock (ah, finally a use for this key), and then use up and down arrows or PgUp or PgDown keys. Press Scroll-Lock again to release.

Have color output in the ls command : ls -G if you want this by default, modify your .profile to have this line: alias ls='ls -G'

Find out information about my system : sysctl -a | more (to look at everything), sysctl -a | grep -i memory (to see memory usage), also try devinfo and swapinfo

Connect via a VPN and use remote desktop to access a Windows machine : See this document

Remove a package : pkg_delete xchat-1.7.1 (where xchat-1.7.1 is the name of the package you want to remove - see next question)

Find out what packages are installed : pkg_info, pkg_version will tell you if there are updates to any of the packages installed on your system.

Change command shell : chsh - can change to bash if installed (will be in /usr/local/bin/bash; I chose bash as an additional package during the install, then I was able to specify this as my user's default shell when I created it.

Change windows managers for X-Windows : I set XFCE as an example; echo "/usr/X11R6/bin/startxfce4" > ~/.xinitrc then startx will run XFCE4.

Modify terminal fonts : To see what other sizes there are = vidcontrol -i mode, To try them out for this session = vidcontrol -f 8x8 /usr/share/syscons/fonts/iso02-8x8.fnt followed by vidcontrol 8x43. To make this happen on startup, see above for the /etc/rc.conf modification.

Power-down when I shutdown and suspend : FreeBSD is apparently still needs a little work with power management on laptops. My laptop, being older has apm enabled, so to allow it to power-down when I ran the shutdown -p now command, I modified my /boot/device.hints file, changed the line hint.apm.0.disabled="1" to be hint.apm.0.disabled="0", then I added the line apm_load="YES" to the /boot/loader.conf file, and finally made the apm modifications to the /etc/rc.conf file (see above section). To suspend the laptop on the fly, type: apm -z. To check the battery, type: apm -l.

Enable spell-checking in nano : add this command to your .profile file: alias nano='nano --speller=ispell', and I add this to my .profile as well: alias pico='nano --speller=ispell'

Restore or add a Boot Loader : Yes, it sometimes happens that you forget to setup a boot loader on a dual-boot system, you finish the install and reboot, only to find the other OS starting by default. Well to add FreeBSD's simple boot loader: Boot the FreeBSD boot floppy or CD again and go to the Custom installation menu item, then select "Partition". Select the drive which used to contain your boot manager (likely the first one) and when you come to the partition editor for it, don't make any changes, but select (W)rite. This will ask for confirmation, select yes, and when you get the Boot Manager selection prompt, be sure to select Boot Manager; this will re-write the boot manager to disk. Then quit out of the installation menu and reboot off the hard disk as normal.

Update Ports : Use a handy new tool called portsnap: type pkg_add -r portsnap then cd /usr/ports(create this folder if necessary) then portsnap fetch followed by portsnap extract. Then in future if you want to update the ports, you'd type portsnap fetch update

Add network routes : Here's an example: route add -net -netmask to make this permanent, you need to add it to the /etc/rc.conf file: This line static_routes="net1 net2 net3" followed by a line for each "net": route_net1="-net -netmask". I got this information from here and here.

Shutdown as a regular user in XFCE : First as root type visudo, then add the following line: myuser myhost=/usr/local/libexec/xfsm-shutdown-helper (substituting myhost and myuser for your user name and host name), then save the file, and you should be able to do a shutdown from within XFCE.

Rebuild the Kernel : I have a short document about this here.

More Questions?

On This document? : Contact me here.

Local Docs : /usr/share/docs; If you are unfamiliar with FreeBSD's directory layout, please refer to the hier(7) man page.

FreeBSD's document on laptops : http://www.freebsd.org/doc/en_US.ISO8859-1/articles/laptop/article.html

FreeBSD Handbook : The handbook (available in multiple formats), and other documentaion and support groups can be found at http://www.freebsd.org.

Need more applications : try here

Hypertext man (manual) pages : are here

© Roqet :: 2022-03-01 16:07:34