Full parsing of Linux File Types

Source: Internet
Author: User

Linux systems differ greatly from Windows systems in terms of file types. Linux File Types and Linux File names represent two different concepts. Similar to file.txt1_file.tar.gz created by general applications, these files must be opened in different programs, but most of them are common files 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:

 
 
  1. [root@localhost ~]# ls -lh install.log  
  2. -rw-r--r-- 1 root root 53K 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

  1. -Rw-r -- 1 root 2 03-27 02: 00 fonts. scale
  2. -Rw-r -- 1 root 53 K 03-16 08:54 install. log
  3. -Rw-r -- 1 root 14 M 03-16 kernel-2.6.15-1.2025_FC5.i686.rpm
  4. Drwxr-xr-x 2 1000 users 4.0 K 04-04 mkuml-2004.07.17
  5. Drwxr-xr-x 2 root 4.0 K 04-19 10:53 mydir
  6. Drwxr-xr-x 2 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;

 
 
  1. [root@localhost ~]# ls -la /dev/tty  
  2. crw-rw-rw- 1 root tty 5, 0 04-19 08:29 /dev/tty  
  3. [root@localhost ~]# ls -la /dev/hda1  
  4. 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.

 
 
  1. [root@localhost ~]# ls -lh /var/lib/mysql/mysql.sock  
  2. srwxrwxrwx 1 mysql mysql 0 04-19 11:12 /var/lib/mysql/mysql.sock 

Note that the first character of the attribute of this file is s. Let's take a look.

5. Symbolic Link file:

 
 
  1. [root@localhost ~]# ls -lh setup.log  
  2. lrwxrwxrwx 1 root root 11 04-19 11: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 shortcuts in Windows. The preceding section describes the Linux file types.

Example of creating a symbolic link file;

 
 
  1. [root@localhost ~]# ls -lh kernel-2.6.15-1.2025_FC5.i686.rpm  
  2. -rw-r--r-- 1 root root 14M 03-16 07:53 kernel-2.6.15-1.2025_FC5.i686.rpm  
  3. [root@localhost ~]# ln -s kernel-2.6.15-1.2025_FC5.i686.rpm  kernel.rpm  
  4. [root@localhost ~]# ls -lh kernel*  
  5. -rw-r--r-- 1 root root 14M 03-16 07:53 kernel-2.6.15-1.2025_FC5.i686.rpm  
  6. lrwxrwxrwx 1 root root  33 04-19 11:27 kernel.rpm -> kernel-2.6.15-1.2025_FC5.i686.rpm 
  1. Novell Linux shoude cloud said it had little to do with Microsoft protocol
  2. Linux system, single user, multi-user, multi-task
  3. Fedora NAC drives the entire market
  4. Linux users can only use the default software.
  5. Ubuntu 10.04 threatens Windows 7

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.