mknod Command

Purpose

Creates a special file.

Syntax

Only executed by root or system group member

mknod Name { b | c } Major Minor

Creates FIFOs (named pipelines)

mknod Name { p }

Description

The mknod command makes a directory entry and corresponding i-node for a special file. The first parameter is the name of the Name entry device. Select a name that is descriptive of the device. The mknod command has two forms that have different flags.

The first form of the mknod command can only be executed by root or a member of the system group. In the first form, the b or c flag is used. The b flag indicates the special file is a block-oriented device (disk, diskette, or tape). The c flag indicates the special file is a character-oriented device (other devices).

The last two parameters of the first form are numbers specifying the Major device, which helps the operating system find the device driver code, and the Minor device, that is the unit drive or line number, which may be either decimal or octal. The major and minor numbers for a device are assigned by the device's configure method and are kept in the CuDvDr class in ODM. It is important that major and minor numbers be defined in this object class to insure consistency of device definitions through the system.

In the second form of the mknod command, the p flag is used to create FIFOs (named pipelines).

Flags

Item Description
b Indicates the special file is a block-oriented device (disk, diskette, or tape).
c Indicates the special file is a character-oriented device (other devices).
p Creates FIFOs (named pipelines).

Security

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in AIX® Version 7.1 Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand.

Examples

To create the special file for a new diskette drive, enter:

mknod /dev/fd2  b 1 2

This creates the /dev/fd2 special file that is a special block file with the major device number 1 and the minor device number 2.

Files

Item Description
/usr/sbin/mknod Contains the mknod command.