// Tutorial //

How To Get Started with FreeBSD 10.1

Published on January 14, 2015
Default avatar
By Justin Ellingwood
Developer and author at DigitalOcean.
How To Get Started with FreeBSD 10.1


FreeBSD is a secure, high performance operating system that is suitable for a variety of server roles. In this guide, we will cover some basic information about how to get started with a FreeBSD server.

Note: As of July 1, 2022, DigitalOcean no longer supports the creation of new FreeBSD Droplets through the Control Panel or API. However, you can still spin up FreeBSD Droplets using a custom image. Learn how to import a custom image to DigitalOcean by following our product documentation.

Step One — Log In with SSH

The first step you need to take to begin configuring your FreeBSD server is to log in.

To log in to your FreeBSD server, use the ssh command. You will need to specify an existing user account along with your server’s public IP address. For the purposes of this tutorial, we’ll assume this user’s name is freebsd:

ssh freebsd@server_IP_address

You should be automatically authenticated and logged in. You will be dropped into a command line interface.

Changing the tcsh Shell Prompt and Defaults (Optional)

When you are logged in, you will be presented with a very minimal command prompt that looks like this:


This is the default prompt for tcsh, the standard command line shell in FreeBSD. In order to help us stay oriented within the filesystem as we move about, we will implement a more useful prompt by modifying our shell’s configuration file.

An example configuration file is included in our filesystem. We will copy it into our home directory so that we can modify it as we wish:

cp /usr/share/skel/dot.cshrc ~/.cshrc

After the file has been copied into our home directory, we can edit it. The vi editor is included on the system by default. If you want a simpler editor, you can try the ee editor:

vi ~/.cshrc

The file includes some reasonable defaults, including a more functional prompt. Some areas you might want to change are the setenv entries:

. . .

setenv  EDITOR  vi
setenv  PAGER   more

. . .

If you are not familiar with the vi editor and would like an easier editing environment, you should change the EDITOR environmental variable to something like ee. Most users will want to change the PAGER to less instead of more. This will allow you to scroll up and down in man pages without exiting the pager:

setenv  EDITOR  ee
setenv  PAGER   less

The other item that we should add to this configuration file is a block of code that will correctly map some of our keyboard keys inside the tcsh session. Without these lines, “Delete” and other keys will not work correctly. This information is found on this page maintained by Anne Baretta. At the bottom of the file, copy and paste these lines:

if ($term == "xterm" || $term == "vt100" \
            || $term == "vt102" || $term !~ "con*") then
          # bind keypad keys for console, vt100, vt102, xterm
          bindkey "\e[1~" beginning-of-line  # Home
          bindkey "\e[7~" beginning-of-line  # Home rxvt
          bindkey "\e[2~" overwrite-mode     # Ins
          bindkey "\e[3~" delete-char        # Delete
          bindkey "\e[4~" end-of-line        # End
          bindkey "\e[8~" end-of-line        # End rxvt

When you are finished, save and close the file.

To make your current session reflect these changes immediately, you can source the file now:

source ~/.cshrc

Your prompt should immediately change to look something like this:

freebsd@hostname:~ %

It might not be immediately apparent, but the “Home”, “Insert”, “Delete”, and “End” keys also work as expected now.

One thing to note at this point is that if you are using the tcsh or csh shells, you will need to execute the rehash command whenever any changes are made that may affect the executable path. Common scenarios where this may happen are when installing or uninstalling applications.

After installing programs, you may need to type this in order for the shell to find the new application files:


Changing the Default Shell (Optional)

The above configuration gives you a fairly good tcsh environment. If you are more familiar with the bash shell and would prefer to use that as your default shell, you can easily make that adjustment.

First, you need to install the bash shell by typing:

sudo pkg install bash

After the installation is complete, we need to add a line to our /etc/fstab file to mount the file-descriptor file system, which is needed by bash. You can do this easily by typing:

sudo sh -c 'echo "fdesc	/dev/fd fdescfs	rw 0 0" >> /etc/fstab'

This will add the necessary line to the end of your /etc/fstab file. Afterwards, we can mount the filesystem by typing:

sudo mount -a

This will mount the filesystem, allowing us to start bash. You can do this by typing:


To change your default shell to bash, you can type:

sudo chsh -s /usr/local/bin/bash freebsd

The next time you log in, the bash shell will be started automatically instead of the tcsh.

If you wish to change the default pager or editor in the bash shell, you can do so in a file called ~/.bash_profile. This will not exist by default, so we will need to create it:

vi ~/.bash_profile

Inside, to change the default pager or editor, you can add your selections like this:

export PAGER=less
export EDITOR=vi

You can make many more modifications if you wish. Save and close the file when you are finished.

To implement your changes immediately, source the file:

source ~/.bash_profile


By now, you should know how to log into a FreeBSD server and how to set up a reasonable shell environment. A good next step is to complete some additional recommended steps for new FreeBSD 10.1 servers.

Afterwards, there are many different directions you can go. Some popular choices are:

Once you become familiar with FreeBSD and configure it to your needs, you will be able to take advantage of its flexibility, security, and performance.

If you’ve enjoyed this tutorial and our broader community, consider checking out our DigitalOcean products which can also help you achieve your development goals.

Learn more here

Tutorial Series: Getting Started with FreeBSD

This series will show you how to get started with a FreeBSD cloud server. The first article will explain some of the differences between Linux and FreeBSD. The tutorials that follow cover the basics of FreeBSD security, maintenance, and software installation. If you are new to FreeBSD, this series will help you get up and running quickly.

About the authors
Default avatar
Developer and author at DigitalOcean.

Still looking for an answer?

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

In case anyone else runs into this:

On first log in, if you are getting prompted for a password, make sure the permissions on your private key are 600 (chmod 600 your_private_key). For some reason my key was created with permissions set to 644 which causes ssh to ignore it (silently). I only found out after trying to use the -i switch to load the key.

Hello, I created a new droplet. FreeBSD operating system. SSH key, but I did not connect to the server providing the SSH connection. Can you help? Root password, but I want to create a password. I do not know your password?

I want to thank you for all of these guides. It has really helped me to get started.