Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand the / dev directory under Linux system

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to understand the / dev directory under the Linux system", the content of the explanation in the article is simple and clear, easy to learn and understand, now please follow the editor's train of thought slowly in depth, together to study and learn "how to understand the / dev directory under the Linux system"!

Dev is an acronym for device. The / dev directory is very important to all users. Because all the external devices used in Linux systems are included in this directory. But here is not the external device driver, which is different from the windows,dos operating system. It is actually a port to access these external devices. We can easily access these external devices, and there is no difference between accessing a file or a directory.

Linux follows the style of Unix, recognizing all devices as a file.

There are two types of device files: block device file (b) and character device file (c). Device files are generally stored in the / dev directory. Common device files are described as follows:

/ dev/hd [amurt]: IDE device

/ dev/sd [amurz]: SCSI device

/ dev/fd [0-7]: standard floppy drive

/ dev/md [0-31]: soft raid device

/ dev/loop [0-7]: local loopback device

/ dev/ram [0-15]: memory

/ dev/null: infinite data receiving device, equivalent to a black hole

/ dev/zero: infinite zero resources

/ dev/tty [0-63]: virtual terminal

/ dev/ttyS [0-3]: serial port

/ dev/lp [0-3]: parallel port

/ dev/console: console

/ dev/fb [0-31]: framebuffer

/ dev/cdrom = > / dev/hdc

/ dev/modem = > / dev/ttyS [0-9]

/ dev/pilot = > / dev/ttyS [0-9]

/ dev/random: random number device

/ dev/urandom: random number device

In linux systems, the / dev directory is used to save device files. Each file points to a system device. The user's program can use these device files

Operate on real hardware devices. For example, hda is the first IDE hard disk, and sda is the first SCSI hard disk.

In the 2.4 kernel era, nearly 10, 000 device files were saved under / dev for all the hardware devices supported by kernel. And most of these devices

There is no connected device. This is a great waste of system resources, and the / dev directory also appears to be very chaotic.

Udev is used to solve these problems. In the 2.6 kernel, udev is used to manage the / dev directory. It can dynamically create / delete device files (devices

When connected to the system, it automatically establishes the corresponding device file, and when the device is disconnected, it automatically deletes the corresponding device file. This makes the / dev directory

It is simplified a lot. In addition, udev allows users to write naming conventions that specify device file names for different devices. In this way, it is convenient to manage the equipment.

A lot.

For example, you have two USB drives, one with a capacity of 1G and one with a capacity of 2G. Normally, the USB disk you attach first will be sdb, and the next USB disk will be sdc. This is right.

It is very inconvenient to use. The device name of the flash drive may be different each time. But through the udev naming convention, you can name the device you specify, and you can name the 1G USB drive as

1g, and the U disk of 2G is named 2g. The device name will not change again. It will be convenient to use and manage.

Thank you for your reading, the above is the content of "how to understand the / dev directory under the Linux system". After the study of this article, I believe you have a deeper understanding of how to understand the / dev directory under the Linux system. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report