Device files
By convention, device files are kept in the /dev directory. Large systems, especially those with networking and pseudo-terminals, may support hundreds of devices.
Device files are created with the mknod command, which has the syntax
mknod filename type major minor
where filename is the device file to be created, type is c for a character device or b for a block device, and major and minor are the major and minor device numbers. If you are creating a device file that refers to a driver that's already present in your kernel, check the man page for the driver to find the appropriate major and minor device numbers.
Red Hat and Debian provide a script called MAKEDEV (in /dev) to automatically supply default values to mknod. Study the script to find the arguments needed for your device. For example, to make PTY entries, you'd use the following commands:
# cd /dev # ./MAKEDEV pty
Naming conventions for devices
Naming conventions for devices are somewhat random. They are often holdovers from the way things were done under UNIX on a DEC PDP-11, as archaic as that may sound in this day and age.
Serial device files are named ttyS followed by a number that identifies the specific interface to which the port is attached. TTYs are sometimes represented by more than one device file; the extra files usually provide access to alternative flow control methods or locking protocols.
The names of tape devices often include not only a reference to the drive itself but also an indication of whether the device rewinds after each tape operation and the density at which it reads and writes.
IDE hard disk devices are named /dev/hdLP, where L is a letter that identifies the unit (with a being the master on the first IDE interface, b being the slave on that interface, c being the master on the second IDE interface, etc.) and P is the partition number (starting with 1). For example, the first partition on the first IDE disk is typically /dev/hda1. SCSI disks are named similarly, but with the prefix /dev/sd instead of /dev/hd. You can drop the partition number on both types of devices to access the entire disk (e.g., /dev/hda).
SCSI CD-ROM drives are referred to by the files /dev/scdN, where N is a number that distinguishes multiple CD-ROM drives. Modern IDE (ATAPI) CD-ROM drives are referred to just like IDE hard disks (e.g., /dev/hdc).