A brief introduction to some of the commands and functionality of the FreeBSD operating system. This guide will cover the commands that a new user will need to initially start working with FreeBSD as well as how to use the FreeBSD manual pages for more information.
1. Configuring and Using Video Modes
1.1 Virtual Consoles
FreeBSD is configured to log users into the system console, this is identified as (ttyv0). System messages will be displayed in this console by default, occasionally causing issues if the user is entering commands.
FreeBSD also supports multiple virtual consoles to help with this problem. By default these consoles can be accessed by a combination of the alt and F-keys. For example, alt+F2 will open the first virtual console, alt+F3 will open the second, and so on. To re-access the system console use alt+F1.
Virtual Consoles can be used to create the feeling of having multiple screens that can be used. In addition, commands that have been entered on one console will continue to run even when the user switches to a different console.
1.2 Changing Video Modes
The FreeBSD video mode is extremely versatile and easy to configure. The video mode can be adjusted to any size supported by the graphics card.
To configure the video mode, first load the VESA module:
$ kldload vesa
Next, you’ll need to determine which video modes are supported. The vidcontrol command can be used to output a list of available modes:
$ vidcontrol -i mode
The list of supported modes will number the video modes as well as containing a brief description of the video mode. To switch the video mode, specify the number of the mode you would like to use, the following is an example for switching to mode 279:
$ vidcontrol MODE_279
1.3 Further Video Configuration
The vidcontrol command used in the last section is an extremely powerful system utility and can be further used to configure the system and virtual consoles.
Navigate to the vidcontrol manual page. Manual pages contain information on commands, as well as instructions for proper use. For example, in the last section we used the vidcontrol command but applied the “-i mode” option. This told the system to list possible video modes that are supported.
Play with the vidcontrol command a bit until you are comfortable with applying parameters to commands. To start off, try to enable the mouse pointer on the console:
$ vidcontrol -m on
The first part of the code is the command, in this case vidcontrol, followed by the command option “-m” instructing the system that the user is applying a change to the mouse pointer. In this case, the -m option has two possible arguments “on” and “off”. Play around further with the command and see if you can change the text color and background.
2. User/Account Management:
2.1 The Superuser Account
Some commands will require superuser, often referred to as “root”, privileges in order to execute. The superuser account has no limitations so it is not recommended to use the account for common commands as a typo or mistake could destroy the operating system. To avoid this, you should only access the superuser account when executing commands that require extra privileges.
While a user could log into the root account on startup, the recommended method is to use the sucommand to access the root account. In order to run this command the user must be in the wheel group. After entering the command, the system will prompt the user to enter the root password:
Once the user is done with the command, the superuser session can be ended by using the exit command:
2.2 Managing User Accounts
A variety of user utilities are included in the FreeBSD operating system. The primary ones will be covered in this section.
The adduser command starts an interactive user-setup that you may recognize from the initial installation of FreeBSD. It is the recommended tool for setting up new accounts because it creates a home directory for the new user.
$ rmuser jru
The rmuser command is the recommended tool for removing accounts and cleaning up the processes and directories associated with the user. The example above is removing the user “jru”.
$ passwd jru
The passwd command can be used to change and set a new password for accounts.
$ pw groupmod wheel -m jru
The pw command is an extremely powerful user group utility. In this example, we are using it to add “jru” to the wheel group. It is recommended to read the manual page for this command as it is quite a bit more complicated than the other commands in this section.
3. Editing Text Files:
3.1 Basic Text Editor
FreeBSD comes with a simple, yet limited, text editor “ee“, or easy editor. This utility opens an editor display and lists the available commands at the top. The following example is how a user would edit the
rc.conf file with easy editor:
$ ee /etc/rc.conf
Once the command has been executed, the display opens and allows you to make changes to the chosen file. The “^” symbol used in the command represents Ctrl and the utility can be quit using the Esc key.
While easy editor is a great utility for a new user, many more experienced users will find the utility to be limited and time-consuming to use.
3.2 Advanced Text Editor
Another text editor that FreeBSD includes is the extremely versatile vi command. Executing the command starts a text-based editor that allows users to directly view and edit text files. The
vi editing options are not listed in the same way as the ee commands, however, more experienced users will find that once they become more experienced with
vi, text editing becomes much easier and less time-consuming. Much like the last section, to edit the rc.conf text file using the
$ vi /etc/rc.conf
Arrow keys can be used to navigate the text file. The editing options can be found listed on the command’s manual page if you scroll down to the second section. These commands can be entered by first hitting the Esc key, followed by the command.
For example, if a user is trying to add text directly after the cursor the user would first hit the Esc key to exit the previous command, then hit the a key. They would then be able to enter the text they wish to add.
Because the sheer number of text-editing options, users should read through the manual page before using the