Special files

The files other than regular files, directories, and link files are special files. They are as follows:

  • The block device file
  • The character device file
  • The named pipe file
  • The socket file

The block device file

A block device file is a file that reads and writes data in block. Such files are useful when data needs to be written in bulk. Devices such as hard disk drive, USB drive, and CD-ROM are considered as block device files. Data is written asynchronously and, hence, other users are not blocked to perform the write operation at the same time.

To create a block device file, mknod is used with the option b along with providing a major and minor number. A major number selects which device driver is being called to perform the input and output ...

Get Linux Shell Scripting Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.