top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do you create special files like named pipes and device files?

+1 vote
458 views
How do you create special files like named pipes and device files?
posted Jan 4, 2016 by Mohammed Hussain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

Using the mknod command, special files can be created.

Mknod [options] name type[major minor]

Here, if argument is “p” a named pipe of FIFO file is created.
If the argument is “b”, a block file is created. Here, the major or minor device numbers needs to be specified.
If the argument is “c or u”, a character file is created. Here, the major or minor device numbers needs to be specified.

Special files are created by the system call ‘mknod’. Upon using the following sequence of steps, a special file will be created.

-new inode is assigned by kernel
-sets the file type as a pipe, directory or special file
-Major and minor device numbers are the two entries created if the file type is a device file.

For example, for a disk, disk controller is the major device number and the disk is the minor device is the disk.

Unix example: $ mknod <pipe name> p
answer Jan 5, 2016 by Manikandan J
Similar Questions
+2 votes

I have a huge code base and it is showing files with zero bytes .
Can someone share a linux command to delete files with zero bytes in one attempt ?

...