Special files in the Linux system

Source: Internet
Author: User

Special files are one of the most distinctive file features in Unix systems. Special files are also called device files. Provides users access to external devices without having to know the specific operation of the various devices. UNIX uses special files as an interface between user and device files, allowing users to access special files as they would access ordinary files.

Special files don't contain any data, she just provides a mechanism for establishing a mapping between physical devices and filenames in a file system. Special files are created with Mknod or system calls and must provide relevant drivers and are integrated into the system kernel. Otherwise, you cannot access the device even if you create a special file.
Mknod special type [major minor]
Where special is the special file name.
Type for special file types, valid types are C: Character special file, P: Pipe file, B: Block special file;
Major is the primary device number that represents the index of the array of device driver pointers organized by device type. Minor is a secondary device number that represents a sub-device in a similar device and can be used as a parameter to invoke the appropriate driver.
Block special files are associated with devices that use data block organization and processing methods. A device that is called a data block organization is actually a storage device capable of transmitting data in a fixed-length block of data, or randomly accessing any of its data blocks. Disk is a typical data block structure of the device, download Linux in the disk and memory is usually a block of data transfer, data blocks to read and write data.
[Email protected]:~$ DF
File system 1k-block already used% mount point available
/dev/sda12 9611492 2992300 6130952 33%/
None 975428 732 974696 1%/dev
None 982040 1180 980860 1%/dev/shm
None 982040 981940 1%/var/run
None 982040 0 982040 0%/var/lock
/DEV/SDA14 96120588 4288760 86949092 5%/Home
[Email protected]:~$ file/dev/sda12
/dev/sda12:block Special
Character Special files: Any device that is not a data organization structure is a character device. Of course, the word traits classes book file is in contrast to the block special file, the character device cannot use a fixed-length block of data and cannot be accessed randomly, and its lowest I/O interface can handle only one character at a time.
For the pipe file has been said before, do not speak.

Special files in the Linux system

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.