restore /dev after `rm`ing it

2014 update: Latest udev versions do not create device nodes at all, and rely on the kernel's devtmpfs to do so. The old answer will therefore stop working if your distribution has a very recent udev. With devtmpfs, the only automated method might be a reboot.


/dev is managed by udev on most Linux distros, so

udevadm trigger

should help.

Restarting udev completely will also work, but it's not necessary, and the command highly depends on distro used.

NOTE: you have to create a few items manually before that command works. /dev/{zero,null}