Device file
From Biocrawler, the free encyclopedia.
A device file or special file is an interface for a device driver that appears in a file system as if it were an ordinary file. This allows software to interact with the device driver using standard input/output system calls, which simplifies many tasks.
Device files often provide simple interfaces to peripheral devices, such as printers. But they can also be used to access specific resources on those devices, such as disk partitions. Finally, device files are useful for accessing system resources that have no connection with any actual device such as data sinks and random number generators.
Unix special files
In Unix and Unix-like operating systems, special files support interaction with device drivers. Special files can be created in any directory, but by convention only appear in the /dev hierarchy. Special files are either character special files, which support byte-level I/O, or block special files, which support I/O in larger units.
Disk partitions are represented by both character special and block special files. A file system in a partition can be mounted, by a command that associates the partition's block special file with a directory called a mount point. This allows all the files on various partitions to be accessed through a single file system hierarchy. A block special file can also be used to manage large masses of data on a partition without use of a file system; this is sometimes used by large-throughput applications, such as databases.
Most non-disk special files are character special files, used for reading and writing simple data streams from peripheral devices.
Some special files have no connection with any actual device. The most important of these is probably the data sink, /dev/null.
MS-DOS device files
MS-DOS borrowed the concept of special files from Unix, but renamed them device files. Because early versions of MS-DOS did not support a directory hierarchy, devices files were distinguished from regular files by making their names reserved words. This means that certain file names are reserved for device files, and cannot be used to name new files or directories.
Microsoft documentation refers to "MS-DOS device files" even under 32-bit versions of Windows, which are not based on MS-DOS. Some MS-DOS device files are listed below:
| File name | Purpose |
| CON | Console device |
| AUX | Auxilliary device |
| COM COM0 COM1 COM2 COM3 COM4 COM5 COM6 COM7 COM8 COM9 | Serial ports |
| LPT1 LPT2 PRN | Parallel ports |
| NUL | Data sink |
Reserved words cannot even be used with extensions, so that file names like "nul.doc" and "con.html" are invalid. This is known to confuse non-technical users.

