D
DevynCJohnson
Guest
On all Linux systems, users will find files that are named after devices along with other files. This is found under /dev/. This is the device folder. On Linux, devices are shown as files. Some of these device files allow users to funnel information into them like they are real files. For instance, users can send errors to /dev/null like this: “SOME_COMMAND 2>/dev/null”. Every user will have different device files. This depends on the kernel, installed features, and hardware present. This article will describe many of the device files under /dev/. However, not all will be included here and some of these may not be supported by your system.
alarm – This allows access the alarm.
ashmem – Android Shared MEMory. This is a shared memory allocator.
autofs – auto-mount filesystems. This virtual device auto-mounts filesystems. This is used when an USB memory card is plugged into the USB ports.
binder – This virtual device uses shared memory to make secure IPC. Inter-Process Communication (IPC) is the concept of many threads (within a process or between processes)to communicate.
block – This directory contains block devices like hard-drives or any other device that handles data in blocks.
bsg – This folder is for Block Scsi Generic drivers.
bus – This directory is for devices on the bus system. For example, when a USB device is plugged into the system, the device will appear in here as a device file.
cdrom – This is a link to /dev/sr0 which is the device file for the cdrom drive.
cdrw - This is a link to /dev/sr0 which is the device file for the cdrom drive. This is specifically used for writing to discs.
char – This device file is for character devices.
console – This device file is the monitor.
core – This is a link to /proc/kcore.
cpu – This is a directory for the CPU virtual devices. Since many systems have more than one processor, this folder would hold all of the device files.
cpu_dma_latency – This virtual device gives the user or process control over the CPU's sleep state. This device will prevent the CPU from entering a deep sleep state when a zero is written to this virtual device.
disk – This folder contains links to the storage units.
dri – This directory contains device files for graphics cards.
dvd - This is a link to /dev/sr0 which is the device file for the cdrom drive. This is used for DVDs.
dvdrw - This is a link to /dev/sr0 which is the device file for the cdrom drive. This link is specifically used for writing to DVDs.
ecryptfs – This device file is used to handle encrypted filesystems.
fb0 – This device file is the currently displayed graphics on the screen. “fb” stands for Frame Buffer. On some systems, typing “sudo cat /dev/urandom > /dev/fb0” will make random pixels on the screen.
fd – This is a link to a directory (/proc/self/fd/). This pseudo-filesystem is the layer beneath the Virtual FileSystem (VFS).
full – This file is used for testing purposes to send software the ENOSPC error when the software tries to write to the virtual device. The ENOSPC error signal mean no space is left on the drive. When read, this virtual drive provides null characters like /dev/zero.
fuse – The FUSE filesystems use this device file.
hpet – The High Precision Event Timer is the device file for timers.
input – This folder holds device files for various input devices like mice and keyboards.
kmsg – Any writes to this device file goes to the kernel's printk buffer.
log – This is a Unix Domain Socket for syslogd. When a process writes to this device file, syslogd will receive the input.
loop0 – This device file can be used to mount “.img” files and ISO files.
loop-control – This device file permits users to create more loop devices as needed.
mapper – This directory contains device files for mapping a block device (like a hard-drive) onto another. These files are important for RAID systems. This is also used for symbolic links.
mcelog – This is the Machine Check Exceptions (MCE) log.
mem – This is the device file for the physical memory. This should not be dealt with unless you know what you are doing.
mouse – This device file represents the mouse. However, most systems do not have this file and have /dev/input/mice and/or /dev/input/mouse0 instead.
net – This directory contains network device files for dealing with packets.
network_latency – This device file deals with power saving features for wireless network devices like Wifi.
null – This is the most commonly known /dev/ device file. Many users use this device file as the end point for data that comes from stderr and sometimes even stdout. For illustration, if a user does not want to see any errors produced by a command, they can type “COMMAND 2> /dev/null”. The normal output (stdout) will still be displayed in the terminal.
oldmem – This device file allows users to access the old memory that the crashed kernel was using. This is perfect for debugging purposes.
port – IO ports can be access through /dev/ports.
ppp – The Point-to-Point Protocol is used to dial the ISP via an analog modem.
psaux – PS/2 mice use these device files.
ptmx – This device file is the pseudoterminal master multiplexer (PTM) which is used with the pseudoterminal slaves (PTS).
pts – Pseudoterminal slaves (PTS) belong in this folder.
ram0 – This device file is for the first RAM chip.
random – This special file is used for random number generation.
rfkill – This device file is used to disable radio transmitters that are part of the system.
rtc – This is a link to /dev/rtc0.
rtc0 – This device file is the Real Time Clock.
sda – This device file is the first SCSI hard-drive.
sda1 – This device represents the first partition of the first SCSI hard-drive.
sg0 – This device file can be the same as /dev/sr0 if /dev/sr0 is also a cd-burner.
sg1 – This is the second cd-burner on the system.
shm – Shared Memory. This device file is tmpfs. If a temporary filesystem is mounted, that memory on RAM can be used to store files. Any mounted tmpfs storage unit is using /dev/shm to use memory space.
snd – This folder contains different audio devices that can be used to make random noise. This folder also shows the installed and active sound drivers.
sr0 – This device file is the first cd/dvd-rom. Some device links link to this file like /dev/cdrom. When a user types “mount -t iso9660 -o ro /dev/cdrom /cdrom”, the system will mount /dev/sr0 to /cdrom/ instead of the link /dev/cdrom.
stderr – This is a link to /proc/self/fd/2. stderr includes the errors that are produced by processes. For example, when a user types a command in a terminal and the command returns an error, that error is stderr.
stdin – This is a link to /proc/self/fd/0. stdin is the input that a user types in a terminal.
stdout – This is a link to /proc/self/fd/1. stdout is the output of processes. For instance, when a user types “date” in a command-line, the output is stdout. When the output of a command is directed to a file, stdout is being directed.
tty – This device file is the currently used terminal. If the user is currently using the system through tty7, then /dev/tty refers to /dev/tty7. “tty” stands for TeleTYpe.
tty1 – This is the first usable virtual console. Press ctrl + left alt + f1 to use tty1. On many laptops, the key combination is ctrl + left alt + fn + f1. Using a different f* key will allow the user to use that virtual console. Usually, f7 is the console that contains the graphical user interface if one is installed.
ttyprintk – This fake (pseudo) TTY device allows users to make printk messages. Printk prints to the kernel log which can be seen by running “dmesg”.
ttyS0 – This is the first serial port. This can be used by old serial mice.
uinput – This file is the interface between the kernel's input system and applications. “uinput” stands for “user input”.
urandom – This device file is like /dev/random except it never locks and will reuse the same internal entropy pool to generate random numbers.
vcs – This file refers to the memory of /dev/tty. “vcs” stands for “Virtual ConSole” or “Virtual Console Screen” (the last is more common).
vcs1 – This file refers to the memory of /dev/tty1.
vcsa – This device file is the same as /dev/vcs but with attributes.
vcsa1 – This device file is the same as /dev/vcs1 but with attributes.
vga_arbiter – This device file is for legacy VGA devices.
watchdog – When a process reads this file, the system will reboot. For illustration, typing “cat /dev/watchdog” will reboot your system.
zero – When this device file is read, it will provide null characters until the reader stops reading this file.
After reading this, many of you may be concerned about security. For example, a virus could use /dev/watchdog to reboot your computer on startup. Well, actually not. Thankfully, the many of these device files and links can only be used by Root. Some, like /dev/cdrom, /dev/stdin, /dev/null, and other such files regular users can use. Linux is a very secure system, so this device system is safe.
alarm – This allows access the alarm.
ashmem – Android Shared MEMory. This is a shared memory allocator.
autofs – auto-mount filesystems. This virtual device auto-mounts filesystems. This is used when an USB memory card is plugged into the USB ports.
binder – This virtual device uses shared memory to make secure IPC. Inter-Process Communication (IPC) is the concept of many threads (within a process or between processes)to communicate.
block – This directory contains block devices like hard-drives or any other device that handles data in blocks.
bsg – This folder is for Block Scsi Generic drivers.
bus – This directory is for devices on the bus system. For example, when a USB device is plugged into the system, the device will appear in here as a device file.
cdrom – This is a link to /dev/sr0 which is the device file for the cdrom drive.
cdrw - This is a link to /dev/sr0 which is the device file for the cdrom drive. This is specifically used for writing to discs.
char – This device file is for character devices.
console – This device file is the monitor.
core – This is a link to /proc/kcore.
cpu – This is a directory for the CPU virtual devices. Since many systems have more than one processor, this folder would hold all of the device files.
cpu_dma_latency – This virtual device gives the user or process control over the CPU's sleep state. This device will prevent the CPU from entering a deep sleep state when a zero is written to this virtual device.
disk – This folder contains links to the storage units.
dri – This directory contains device files for graphics cards.
dvd - This is a link to /dev/sr0 which is the device file for the cdrom drive. This is used for DVDs.
dvdrw - This is a link to /dev/sr0 which is the device file for the cdrom drive. This link is specifically used for writing to DVDs.
ecryptfs – This device file is used to handle encrypted filesystems.
fb0 – This device file is the currently displayed graphics on the screen. “fb” stands for Frame Buffer. On some systems, typing “sudo cat /dev/urandom > /dev/fb0” will make random pixels on the screen.
fd – This is a link to a directory (/proc/self/fd/). This pseudo-filesystem is the layer beneath the Virtual FileSystem (VFS).
full – This file is used for testing purposes to send software the ENOSPC error when the software tries to write to the virtual device. The ENOSPC error signal mean no space is left on the drive. When read, this virtual drive provides null characters like /dev/zero.
fuse – The FUSE filesystems use this device file.
hpet – The High Precision Event Timer is the device file for timers.
input – This folder holds device files for various input devices like mice and keyboards.
kmsg – Any writes to this device file goes to the kernel's printk buffer.
log – This is a Unix Domain Socket for syslogd. When a process writes to this device file, syslogd will receive the input.
loop0 – This device file can be used to mount “.img” files and ISO files.
loop-control – This device file permits users to create more loop devices as needed.
mapper – This directory contains device files for mapping a block device (like a hard-drive) onto another. These files are important for RAID systems. This is also used for symbolic links.
mcelog – This is the Machine Check Exceptions (MCE) log.
mem – This is the device file for the physical memory. This should not be dealt with unless you know what you are doing.
mouse – This device file represents the mouse. However, most systems do not have this file and have /dev/input/mice and/or /dev/input/mouse0 instead.
net – This directory contains network device files for dealing with packets.
network_latency – This device file deals with power saving features for wireless network devices like Wifi.
null – This is the most commonly known /dev/ device file. Many users use this device file as the end point for data that comes from stderr and sometimes even stdout. For illustration, if a user does not want to see any errors produced by a command, they can type “COMMAND 2> /dev/null”. The normal output (stdout) will still be displayed in the terminal.
oldmem – This device file allows users to access the old memory that the crashed kernel was using. This is perfect for debugging purposes.
port – IO ports can be access through /dev/ports.
ppp – The Point-to-Point Protocol is used to dial the ISP via an analog modem.
psaux – PS/2 mice use these device files.
ptmx – This device file is the pseudoterminal master multiplexer (PTM) which is used with the pseudoterminal slaves (PTS).
pts – Pseudoterminal slaves (PTS) belong in this folder.
ram0 – This device file is for the first RAM chip.
random – This special file is used for random number generation.
rfkill – This device file is used to disable radio transmitters that are part of the system.
rtc – This is a link to /dev/rtc0.
rtc0 – This device file is the Real Time Clock.
sda – This device file is the first SCSI hard-drive.
sda1 – This device represents the first partition of the first SCSI hard-drive.
sg0 – This device file can be the same as /dev/sr0 if /dev/sr0 is also a cd-burner.
sg1 – This is the second cd-burner on the system.
shm – Shared Memory. This device file is tmpfs. If a temporary filesystem is mounted, that memory on RAM can be used to store files. Any mounted tmpfs storage unit is using /dev/shm to use memory space.
snd – This folder contains different audio devices that can be used to make random noise. This folder also shows the installed and active sound drivers.
sr0 – This device file is the first cd/dvd-rom. Some device links link to this file like /dev/cdrom. When a user types “mount -t iso9660 -o ro /dev/cdrom /cdrom”, the system will mount /dev/sr0 to /cdrom/ instead of the link /dev/cdrom.
stderr – This is a link to /proc/self/fd/2. stderr includes the errors that are produced by processes. For example, when a user types a command in a terminal and the command returns an error, that error is stderr.
stdin – This is a link to /proc/self/fd/0. stdin is the input that a user types in a terminal.
stdout – This is a link to /proc/self/fd/1. stdout is the output of processes. For instance, when a user types “date” in a command-line, the output is stdout. When the output of a command is directed to a file, stdout is being directed.
tty – This device file is the currently used terminal. If the user is currently using the system through tty7, then /dev/tty refers to /dev/tty7. “tty” stands for TeleTYpe.
tty1 – This is the first usable virtual console. Press ctrl + left alt + f1 to use tty1. On many laptops, the key combination is ctrl + left alt + fn + f1. Using a different f* key will allow the user to use that virtual console. Usually, f7 is the console that contains the graphical user interface if one is installed.
ttyprintk – This fake (pseudo) TTY device allows users to make printk messages. Printk prints to the kernel log which can be seen by running “dmesg”.
ttyS0 – This is the first serial port. This can be used by old serial mice.
uinput – This file is the interface between the kernel's input system and applications. “uinput” stands for “user input”.
urandom – This device file is like /dev/random except it never locks and will reuse the same internal entropy pool to generate random numbers.
vcs – This file refers to the memory of /dev/tty. “vcs” stands for “Virtual ConSole” or “Virtual Console Screen” (the last is more common).
vcs1 – This file refers to the memory of /dev/tty1.
vcsa – This device file is the same as /dev/vcs but with attributes.
vcsa1 – This device file is the same as /dev/vcs1 but with attributes.
vga_arbiter – This device file is for legacy VGA devices.
watchdog – When a process reads this file, the system will reboot. For illustration, typing “cat /dev/watchdog” will reboot your system.
zero – When this device file is read, it will provide null characters until the reader stops reading this file.
After reading this, many of you may be concerned about security. For example, a virus could use /dev/watchdog to reboot your computer on startup. Well, actually not. Thankfully, the many of these device files and links can only be used by Root. Some, like /dev/cdrom, /dev/stdin, /dev/null, and other such files regular users can use. Linux is a very secure system, so this device system is safe.