mknod — Make a FIFO or character special file

Format

  • mknod pathname [b c] major minor
  • mknod pathname p

Description

mknod creates a FIFO special file or a character special file with the given path name. It is located in the directory /usr/sbin.

Operands

b
Indicates block special files. b is accepted for compatibility with other UNIX implementations.

Restriction: Block special files are not supported on z/OS®.

c
Indicates character special files (for example, terminals and other devices). c can only be used by a superuser.
major minor
major gives the major device type; minor, the minor device type. You can specify device types in decimal, hexadecimal, or octal.
mknod differentiates between octal and decimal as follows:
  • Any number that starts with 0 but not 0x is octal.
  • Any number that starts with 0x is hexadecimal.
  • Any number that does not start with 0x or 0 is decimal.
p
Creates a FIFO special file (that is, a named pipe).

Localization

mknod uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Exit values

0
Successful completion
1
Failure due to any of the following:
  • Inability to create the desired file
  • Incorrect major or minor number
2
Failure due to any of the following:
  • Too few command-line arguments
  • A missing major or minor device number

Portability

UNIX systems. Within POSIX, mknod has been superseded by mkfifo for pipes. The POSIX family of standards has not yet designed an alternative to mknod for special files.

Related information

mkfifo