Iam trying to understand mknod command, but got stuck here .In linux udev service detects devices connected to the linux machine ,then what is the need of the mknod command .please help..
Iam trying to understand mknod command, but got stuck here .In linux udev service detects devices connected to the linux machine ,then what is the need of the mknod command .please help..
Udev is a subsystem used to automate hardware configuration while mknod is a tool to create special files as defined by POSIX primarily FIFOs. Although much of its functionality has been superseded by other tools like mkfifo. It's there for compatibility.
Edit: Alright lets provide more context. mknod is a Unix sys call as well its a command that impliments some of the functionality of that sys call. The sys call makes file "nodes" of any type including regular files. It's how the kernel makes every file node.
The command mknod is primarily able to make FIFOs and device files. In POSIX mknod command is so that device files can be hooked up to device drivers. POSIX also defines mkfifo as a more specific command for FIFOs. It can not be used to make regular files or UNIX socket files.
Since udev handles loading drivers and creating these device files system admins don't really need to make them using mknod. This is a feature of automation provided in Linux while a "Unix-like" system still maintains the ability to use mknod. Further a non-POSIX function makedev can also be used to make device files. This is the underlying syscall Linux uses to setup devices and the respective command can be used in place of mknod.