How to transform a process into a daemon in Linux / Unix

In this article I will show you how to daemonize processes with nohup, in Linux and Unix.

Watch Free Movies

What is a daemon?

A daemon is a process with no output and input, running independently from the terminal. A daemon dies only when the init process is killed. The important services in Linux are all daemons.

A daemon’s behaviour can be modified from its configuration file. Example /etc/ssh/sshd_config is the configuration file for sshd on Debian (and friends). Like any other process/service in Linux and Unix, you can kill a daemon with kill or pkill.

So, to create a daemon, you have to redirect the stdout and stderr to /dev/null, detach the process from the terminal and make in run in background:

I will daemonize my Firefox. This is usefull because my browser will not close when I logout/close the terminal.

$ nohup firefox& &> /dev/null

Scroll to Top