What is the mknod command used for?

mknod was originally used to create the character and block devices that populate /dev/. Nowadays software like udev automatically creates and removes device nodes on the virtual filesystem when the corresponding hardware is detected by the kernel, but originally /dev was just a directory in / that was populated during install.

So yes, in case of a near complete disaster causing the /dev virtual filesystem not to load and/or udev failing spectacularly, using mknod to painstakingly repopulate at least a rudimentary device tree to get something back up can be done... But yeah, that's sysadmin horror story time. Personally, I recommend a rescue USB stick or CD.

Aside from creating named pipes, I can't think of a single possible day-to-day use for it that an end user would need to concern themselves with -- and even that is stretching the definition of 'day to day use'.


You can make a named pipe with it.

I use it with one program to read from it, and another one to write into it.

Makes it easier to communicate between processes.

Otherwise, you may create device files, for devices that aren't present.

Also: http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.cmds/doc/aixcmds3/mknod.htm


As oracle DBAs working on raw devices to create Oracle ASM diskgroups, we regularly use mknod to link devices.

The replies above were very helpful to me as we are not system admins. I just wanted to point out that it might be rare from storage admins' point of view to use mknod but from Oracle ASM point of view its a common use. (May be someone could come up with a better way for us?)