File types for Linux

Source: Internet
Author: User

Linux files are typically created with a number of related applications, such as tools, documentation tools, archive tools .... or CP tools. The way to delete a Linux file is with the RM command.

Linux file type;
The Linux file type and the name of the Linux file represent the meanings of two different concepts. We create through general applications such as File.txt, file.tar.gz, these files, although to be opened with different programs, but in the Linux file type measurement, mostly regular files (also known as ordinary files).

Linux file types are common: ordinary files, directories, character device files, block device files, symbolic link files, etc. now we have a brief description;

1 Common Files
[Email protected] ~]# LS-LH Install.log
-rw-r--r--1 root root 53K 03-16 08:54 Install.log
We use LS-LH to see the properties of a file, we can see similar-rw-r--r--, it is worth noting that the first symbol is-, such a file in Linux is a normal file. These files are typically created with some related applications, like tools, document tools, archive tools .... or CP tools. This type of file is deleted using the RM command;

2 directory
[[email protected] ~]# ls-lh
Total 14M
-rw-r--r--1 root root   & nbsp 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 users 4.0K 04-04 23:30 mkuml-2004.07.17
D Rwxr-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 , see similar drwxr-xr-x, such a file is a directory, directory in Linux is a more special file. Note that its first character is d. The command to create a directory can be used with the mkdir command, or the CP command, where CP can copy a directory to another directory. Remove the RM or RMDIR command.

3 character device or block device file
If you enter the/dev directory, list the files, you will see similar to the following;
[Email protected] ~]# Ls-la/dev/tty
Crw-rw-rw-1 Root TTY 5, 0 04-19 08:29/dev/tty
[Email protected] ~]# ls-la/dev/hda1
Brw-r-----1 Root Disk 3, 1 2006-04-19/dev/hda1
We see that the/dev/tty property is crw-rw-rw-, note that the first character in front is C, which represents the character device file. such as the cat and other serial devices
We see that the/dev/hda1 property is brw-r-----, note that the first character in front is B, which indicates a block device, such as a hard disk, an optical drive, and other devices;
This kind of file is created with Mknode and deleted with RM. Currently in the latest Linux distributions, we generally do not have to create the 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.
[Email protected] ~]# Ls-lh/var/lib/mysql/mysql.sock
srwxrwxrwx 1 mysql mysql 0 04-19 11:12/var/lib/mysql/mysql.sock
Note that the first character of the property of this file is S. We'll just have a look.

5 Symbolic Link File
[Email protected] ~]# LS-LH Setup.log
lrwxrwxrwx 1 root root one 04-19 11:18 setup.log install.log
When we look at the properties of a file, we see something like lrwxrwxrwx, note that the first character is L, and this type of file is a linked file. is the new file name by ln-s the source file name. 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 the shortcuts in the Windows operating system.

Example of how to create a symbolic link file;
[Email protected] ~]# 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
[Email protected] ~]# ln-s kernel-6.15-1.2025_fc5.i686.rpm kernel.rpm
[Email protected] ~]# 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 04-19 11:27 kernel.rpm kernel-6.15-1.2025_fc5.i686.rpm

File types for Linux

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.