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

Linux basic command-mknod

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Mknod

Create a block device or character device file. The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.

1. Grammar

Mknod [option] device name device type primary device number secondary device number

2. List of option parameters

Option

Description

-- version

Display command version information

-- help

Display help information

-m |-- mode=MODE

Set permissions

-Z |-- context=CTX

Set the security context of SELinux

Device Typ

B, block device; c, character device; u, unbuffered character device; pGrady FIFO device

Device number

It can only be decimal and octal, and if it starts with 0x, it's still decimal. For b, c, u devices, the device number must be given, and for p devices, the device number must be ignored

When the type is b, c, or u, you must specify both the primary and secondary numbers; when the type is p, you must omit them. If the primary or secondary device number begins with 0x or 0x, it is interpreted as hexadecimal; otherwise, if it starts with 0 as octal, the rest is decimal.

3. Examples

1) create a block device file

[root@localhost ~] # mknod / dev/sdb4 b 1 1 / / create a device

[root@localhost weijie] # ls-l / dev/sdb4

Brw-r--r-- 1 root root 1, September 7 08:21 / dev/sdb4

2) create a character device file

[root@localhost ~] # mknod / dev/ttywj c 2 1 / / create a device

[root@localhost weijie] # ls-l / dev/ttywj

Crw-r--r-- 1 root root 2, September 7 09:42 / dev/ttywj

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