UNIX System Management: Configuring Device files

Source: Internet
Author: User
Keywords UNIX System Management device files
Tags address control data different directory disk example external

After learning this chapter, you will be able to do the following things:

Explain the purpose of the device file

Explain the significance of the main and minor numbers

Describes the difference between a block device and a character device

Use Lsdev to list the master number of the kernel driver

Use LS to observe the main and secondary numbers of a device file

Use Ioscan to list the device files associated with a specified device

Use ISSF to describe the characteristics of a device file.

Assign a disk, tape, or CD device file name, determine the target number of the control card and the destination address of the associated device

Assign a terminal or a xiandai device filename, and determine the port number of the control card number and associated device.

How the AutoConfig process works

Using INSF to create a device file

What is the device file?

The operating system communicates with external devices (for example, tape drives, disk drives, printers, terminals, Xiandai) through a file called a device file. UNIX input and output to an external device is the same way as the input output to a file. Before UNIX communicates with an external device, the device must first have a device file present. For example, each terminal has its own device file for UNIX to write data (appearing on the terminal screen) and read data (the user enters through the keyboard).

Device files are not the same as normal files, and the device file does not contain any data.

The operating system communicates with a device through a device file. The device file exists in the/dev directory.

Note: Device files are synonymous with special files. You can swap these two terms.

Because the UNIX operating system creates all the device files for you, you need to know the device file name for the device when you access an external device. 8630.html "> Sometimes you'll need to create a device file yourself. If you permanently remove an external device, you should delete its corresponding device file.

The following examples illustrate how UNIX commands use a device file:

#tar-CVF/DEV/RMT/0M/USR

The TAR application uses the-F option to open a file for output. Then tar backs up the data to that file. Tar can be written to a common file or directly to a device. Tar does not need to know the difference between them.

# echo Hello >/dev/tty0p1

In this example, the standard output of the echo command is redirected to a terminal by means of the device file of this terminal

Use LS to list device files

List device file names using LS/dev

BRW-R-----1 root sys 0x005000 modified 1997/dev/dsk/c0t5d0

BRW-R-----1 root sys 0x006000 modified 1997/dev/dsk/c0t6d0

CRW-R-----1 root sys 0x005000 modified 1997/dev/rdsk/c0t5d0

CRW-R-----1 root sys 0x006000 modified 1997/dev/rdsk/c0t6do

Crw-r-----2 Root TTY 0x000001 9 09:25/dev/ttyp1

Crw-r-----2 Root TTY 0x000002 9 17:25/dev/ttyp2

Device file type main Number minor device file name

Device files are usually in the/dev directory. You can use the LS command to list the files in this directory, just as you would list files in other directories. Note: The device files listed in LS are a little bit different from other files.

Related Article

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.