How To Start, Stop or Restart A Service In FreeBSD?

In a Unix like operating system, a service is a computer program or an application that runs in the background and performs some essential tasks. It does not provide any interface to interact with the system.

The services are also known as daemons. Generally, the name of daemons ends with the letter d. For example- sshd, natd, etc.

This article explains starting, restarting, or stopping services in FreeBSD.

The init system in FreeBSD

Like most of the modern Linux distributions uses systemd as the init system, FreeBSD uses rc system of the startup script which manages services at the boot time of a FreeBSD system.


The services that are to be started while system boot is mentioned in a file called rc.conf which resides in /etc/ directory. You can enable or disable a service by modifying this file.

For example to enable sshd in a system, first open /etc/rc.conf file with a text editor

vi /etc/rc.conf

And then add or modify the given line –


Now save the file and exit from the editor.

[alert color=”yellow”]Run all the commands given in this article as root or with superuser privileges[/alert]

How to check the status of a service

To check whether a service is running or not, use the following command in the terminal –

service service_name status

For instance to check whether sshd is running or not, use –

service sshd status

How to start a service

For example to start a service called sshd in your system, run the following command in your terminal –

service sshd start

This command will start the ssh daemon if it is not running already.

How to restart a service

After making changes in the configuration, sometimes you need to restart a service in a system. You can use the command as given below –

service sshd restart

This will restart the ssh daemon.

How to stop a service

Now if you want to stop a running service then you can use the following command in the terminal.

service sshd stop

This command will stop the running ssh daemon.


Ok, that’s all for now. If you have a query related to this article then write us in the command below.

Leave a Comment