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:
- [root@localhost ~]# ls -lh install.log
- -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
- -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-2.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 4.0 K 04-19 10:53 mydir
- 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;
- [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 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/mysql.sock
- 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:
- [root@localhost ~]# ls -lh setup.log
- 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;
- [root@localhost ~]# ls -lh kernel-2.6.15-1.2025_FC5.i686.rpm
- -rw-r--r-- 1 root root 14M 03-16 07:53 kernel-2.6.15-1.2025_FC5.i686.rpm
- [root@localhost ~]# ln -s kernel-2.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-2.6.15-1.2025_FC5.i686.rpm
- lrwxrwxrwx 1 root root 33 04-19 11:27 kernel.rpm -> kernel-2.6.15-1.2025_FC5.i686.rpm
- Novell Linux shoude cloud said it had little to do with Microsoft protocol
- Linux system, single user, multi-user, multi-task
- Fedora NAC drives the entire market
- Linux users can only use the default software.
- Ubuntu 10.04 threatens Windows 7