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

What are the classifications of Linux file types

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

Share

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

Today, I will talk to you about the classification of Linux file types, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

1 ordinary files

[root@localhost ~] # ls-lh install.log

-rw-r--r-- 1 root root 53K 03-16 08:54 install.log

When we use ls-lh to look at the properties of a file, we can see that it is similar to-rw-r--r--. It is worth noting that the symbol is -. Such a file is a normal file in Linux. These files are generally created with related applications, such as image tools, documentation tools, archiving tools. Or cp tools, etc. Such files can be deleted by using the rm command

2 directory

[root@localhost ~] # ls-lh

Total 14m

-rw-r--r-- 1 root root 2 03-27 02:00 fonts.scale

-rw-r--r-- 1 root root 53K 03-16 08:54 install.log

-rw-r--r-- 1 root root 14M 03-16 07:53 kernel-6.15-1.2025_FC5.i686.rpm

Drwxr-xr-x 2 1000 users 4.0K 04-04 23:30 mkuml-2004.07.17

Drwxr-xr-x 2 root root 4.0K 04-19 10:53 mydir

Drwxr-xr-x 2 root root 4.0K 03-17 04:25 Public

When we execute in a directory, we see a file like drwxr-xr-x, which is a directory, and a directory is a special file in Linux. Notice that its * character is d. The command to create a directory can use the mkdir command or the cp command, and cp can copy one directory to another. Delete with the rm or rmdir command.

3-character device or block device file

If you go to the / dev directory, list the files, and you will see something like this

[root@localhost ~] # ls-la / dev/tty

Crw-rw-rw- 1 root tty 5, 0 04-19 08:29 / dev/tty

[root@localhost ~] # ls-la / dev/hda1

Brw-r- 1 root disk 3, 1 2006-04-19 / dev/hda1

We see that the attribute of / dev/tty is crw-rw-rw-, notice that the first * character is c, which represents the character device file. Serial port devices such as cats

We see that the attribute of / dev/hda1 is brw-r-, and notice that the first * * character is b, which indicates a block device, such as a hard disk, CD-ROM drive, etc.

This kind of file is created with mknode and deleted with rm. Currently, in Linux distributions of *, we generally do not have to create device files ourselves. Because these files are associated with the kernel.

4 sets of interface files

When we start the MySQL server, a mysql.sock file is generated.

[root@localhost ~] # ls-lh / var/lib/mysql/mysql.sock

Srwxrwxrwx 1 mysql mysql 0 04-19 11:12 / var/lib/mysql/mysql.sock

Note that the * character of the attribute of this file is s. Let's just get to know it.

5 symbolic link file

[root@localhost ~] # ls-lh setup.log

Lrwxrwxrwx 1 root root 11 04-19 11:18 setup.log-> install.log

When we look at the file properties, we will see something like lrwxrwxrwx. Note that the * * character is l, and this kind of file is a linked file. Is through the ln-s source file name new file name. The above is an example that indicates that setup.log is a soft link file for install.log. How do you understand it? This is somewhat similar to shortcuts in the Windows operating system.

An example of the method of creating symbolic link files

[root@localhost] # ls-lh kernel-6.15-1.2025_FC5.i686.rpm

-rw-r--r-- 1 root root 14M 03-16 07:53 kernel-6.15-1.2025_FC5.i686.rpm

[root@localhost] # ln-s kernel-6.15-1.2025_FC5.i686.rpm kernel.rpm

[root@localhost ~] # ls-lh kernel*

-rw-r--r-- 1 root root 14M 03-16 07:53 kernel-6.15-1.2025_FC5.i686.rpm

Lrwxrwxrwx 1 root root 33 04-19 11:27 kernel.rpm-> kernel-6.15-1.2025_FC5.i686.rpm

After reading the above, do you have any further understanding of the classification of Linux file types? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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