Linux File Types

Source: Internet
Author: User
Linux Files are generally created using related applications, such as tools, document tools, archiving tools... or CP tools. To delete a Linux File, run the RM command.

Linux file type;
Linux File Types and Linux File names represent two different concepts. Similar to file.txt1_file.tar.gz created by a general application, although these files must be opened in different programs, most of them are normal files (also known as common files) that are measured in Linux file types ).

Common types of Linux Files include common files, directories, character device files, block device files, and symbolic link files. Now let's give a brief description;

1. Common File
[Root @ localhost ~] # Ls-lH install. Log
-RW-r -- 1 Root 53 K 03-16 08:54 install. Log
We use LS-lH to view the attributes of a file. We can see that there is a file like-RW-r --. It is worth noting that the first symbol is -, such a file is a common file in Linux. These files are generally created using related applications, such as tools, document tools, archiving tools... or CP tools. To delete such files, run the RM command;

2 Directory
[Root @ localhost ~] # Ls-lH
Total 14 m
-RW-r -- 1 Root 2 03-27 02: 00 fonts. Scale
-RW-r -- 1 Root 53 K 03-16 08:54 install. Log
-RW-r -- 1 Root 14 m 03-16 kernel-6.15-1.2025_FC5.i686.rpm
Drwxr-XR-x 2 1000 users 4.0 K 04-04 mkuml-2004.07.17
Drwxr-XR-x 2 root Root 4.0 K 04-19 10:53 mydir
Drwxr-XR-x 2 root Root 4.0 K 03-17 04-25 public
When we run the command in a directory, we can see a file like drwxr-XR-X, which is a directory. The directory is a special file in Linux. Note that its first character is D. Run mkdir or CP to create a directory. CP can copy one directory to another. Delete the file by using the RM or rmdir command.

3-character device or block Device File
If you enter the/dev directory and list the files, you will see something similar to the following;
[Root @ localhost ~] # Ls-La/dev/tty
CrW-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 can see that the attribute of/dev/tty is CrW-RW-. Note that the first character is C, which indicates the character device file. Serial devices such as cats
We can see that the attribute of/dev/hda1 is BRW-r -----. Note that the first character is B, which indicates a device, such as a hard disk or a optical drive;
Files of this type are created using mknode and deleted using RM. Currently, in the latest Linux release, we generally do not need to create device files on our own. Because these files are associated with the kernel.

Four interface files
When we start the MySQL server, a MySQL. Sock file is generated.
[Root @ localhost ~] # Ls-LH/var/lib/MySQL. Sock
Srwxrwxrwx 1 MySQL 0 04-19 11: 12/var/lib/MySQL. Sock
Note that the first character of the attribute of this file is S. Let's take a look.

5. Symbolic Link file
[Root @ localhost ~] # Ls-lH setup. Log
Lrwxrwxrwx 1 Root 11 04-19 :18 setup. Log-> install. Log
When viewing the file attributes, we will see lrwxrwxrwx. Note that the first character is l, and this type of file is a link file. Is a new file name through the Ln-S source file name. The preceding example shows that setup. log is a soft link file of Install. log. How can this problem be solved? This is similar to the shortcut in windows.

Example of creating a symbolic link file;
[Root @ localhost ~] # Ls-lH kernel-6.15-1.2025_FC5.i686.rpm.
-RW-r -- 1 Root 14 m 03-16 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 -- 1 Root 14 m 03-16 kernel-6.15-1.2025_FC5.i686.rpm
Lrwxrwxrwx 1 Root 33 04-19 kernel. rpm-> kernel-6.15-1.2025_FC5.i686.rpm

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.