Freebsd – How to create /dev/null on BSD

devicesfreebsd

A wrongly written script deleted /dev/null on my system. I did find an answer here and tried it out. But as soon as I write something to the new /dev/null, the system crashes. I'm afraid that answer's not for BSD.

Can anyone help?

It's FreeBSD 10.3

Best Answer

On FreeBSD:

mknod /dev/null c 15 0 root:wheel
chmod 0666 /dev/null

As you found out, numbers 15 and 0 are not portable to other systems.

Related Question