From man mknod on Linux:

 c, u   create a character (unbuffered) special file

Why are there 2 letters for the same function? Is there any subtle difference, or they are completely alike?


They're identical, at least on Linux.

I came to this conclusion by first looking at the source code for mknod(1) in the GNU coreutils, where on line 217 in the current version we find that the 'c' and 'u' cases are treated identically, getting the same device type. The S_IFCHR value is defined in the Linux kernel headers, but the value is not important. All that matters is that the same value gets stored in the filesystem's dev node.

I clinched the issue with a simple test:

$ sudo mknod /dev/null2 u 1 3
$ ls -l /dev/null*
crw-rw-rw- 1 root root 1, 3 Jan 12  2015 /dev/null
crw-r--r-- 1 root root 1, 3 Oct 19 22:56 /dev/null2

A u in the command gives the same dev node as c. Case closed.

As to why both characters are allowed, my best guess is that it's just an alias for those who think of b as meaning "buffered" rather than "block," so that you need u as its opposite, meaning "unbuffered," rather than c for "character."

I originally thought that this feature of GNU mknod might have been for compatibility with some pre-Linux flavor of Unix, since mknod in GNU Fileutils predates Linux itself,¹ and this feature of GNU mknod goes clear back to the very first version-controlled checkin of mknod.c, but I have yet to find documentation for any Unix that will accept u as an argument to mknod(1), so that hypothesis doesn't hold water.²


  1. A mknod utility was added to GNU Fileutils in July 1991. The first version of the Linux kernel wasn't posted to Usenet until September 1991. That tells us that the first version of GNU mknod must have supported non-Linux OSes from the start.

  2. I've checked the online man pages for Solaris, HP-UX, AIX, FreeBSD, SCO OpenServer, SCO UnixWare, Minix 2, Ultrix, 2.11BSD, and OS X.

    You will find mknod u documented for other OSes — such as Minix 3 — but only because they're also using the GNU Coreutils implementation of mknod(1). Another oddity is modern Solaris, which ships both AT&T mknod and GNU mknod, documented separately in manual sections 1m (linked above) and in section 1g, respectively.

| improve this answer | |
  • It makes perfect sense that the GNU utilities would have supported some non-Linux kernel, because GNU started (in 1984) by writing free replacements for various UNIX utilities to run on UNIX systems. When Torvalds released the Linux kernel, that just added one large missing piece towards making a full operating system unencumbered by UNIX "intellectual property". In fact, today, there's GNU Hurd. You may want to compare my answer to Were all Unix commands re-written in Linux? which has more of the relevant history than can fit in a comment. – a CVn Oct 20 '16 at 7:42
  • 1
    For the record, it's not documented in current manpages available online for HP-UX, AIX, Ultrix, or SCO Unix (which supports several other file types in mknod), either, and it's not present in any version of Minix that I found source code for. – Random832 Oct 20 '16 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.