Home > Operation and Maintenance > Linux Operation and Maintenance > Why does the green color appear when decompressing a zip file in Linux?

Why does the green color appear when decompressing a zip file in Linux?

青灯夜游
Release: 2023-03-14 10:58:37
Original
3297 people have browsed it

Cause: The decompressed zip file is an executable file. Different colors of files in Linux represent different file types: 1. Blue, represents directory type; 2. White, represents general files; 3. Light blue, represents link type; 4. Green, represents executable files; 5. , red, represents compressed files; 6. yellow, represents device files; 7. gray, represents other files; 8. flashing red, represents a problem with the linked file.

Why does the green color appear when decompressing a zip file in Linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

Linux decompresses the zip file and displays green, which means that the decompressed zip file is an executable file.

Different colors of files in Linux represent different file types. Detailed explanation of Linux file type colors:

Color File type
Blue Directory
White General files
Light blue Link
Green Executable file
Red Compressed file
Yellow Device files
Gray Other files
Red flashing There is a problem with the linked file

7 types of files in Linux system

Everything in Linux is a file, and there are many types of files. You can view file attribute information through the ls -l command, where the first character at the beginning of the line represents the file type of the file.

There are a total of seven file types in the Linux system. The seven file types and the characters representing the corresponding types are listed below:

1. Ordinary files

After using the ls -l command, the files whose first character in the first column is "-" are ordinary files. As shown in the figure above, ordinary files are generally in gray font, and those in green font are OK Executable files, the ones in red font are compressed files.

Why does the green color appear when decompressing a zip file in Linux?

File permissions:

Taking an ordinary file as an example, use the ls -l command to see the first result The column is in the form of -rwxrwxrwx, where the first character "-" indicates that the file is a normal file. It can also be other characters. Different characters represent different types of files. The following string of characters indicates the permissions of the file, among which:

1) r indicates that the file has readable permissions. If the position is "-", it indicates that the file is unreadable;

2) w indicates that the file has write permission. If the position is "-", it indicates that the file is not writable;

3) x indicates that the file has executable permission. If the position is "-" , indicating that the file does not have executable permissions;

To create a normal file, you can use the touch command to create a file:

touch  newfile
Copy after login

2. Directory file

Directories in Linux are also files. Directory files store information such as inode numbers and file names of other files in the directory. Each data item in the directory file points to a certain file inode. link, deleting the file name is equivalent to deleting the corresponding link. The font color of the directory file is blue. Use the ls -l command to view it. The first character is "d" (directory).

Why does the green color appear when decompressing a zip file in Linux?

Permissions of directory files:

1) r indicates that the directory file has readable permissions, that is, it can be viewed using the ls command The storage status of this directory;

2) w indicates that the directory file has write permission, so you can add, modify, and delete files in the directory;

3) x indicates that the directory file has For executable files, you can use the cd command to enter the directory.

Create a directory. You can use the mkdir command to create a directory file:

mkdir directory
Copy after login

3. Device file

Linux Hardware devices such as hard disks, mice, etc. are also represented as files, that is, device files. Device files are generally stored in the /dev/ directory, and the file names are yellow, as follows:

Why does the green color appear when decompressing a zip file in Linux?

Device files are divided into the following two types:

  • Block device files:

    Block device files support access in blocks. In the EXT4 file system, a block is usually 4KB in size, which means that 4096 (or an integer multiple thereof) of data can be accessed at a time. Applications can randomly access the data of block device files, and the program can determine the location of the data by itself. Hard disks, floppy disks, etc. are all block devices. Use the ls -l command to view the first character of the block device file is "b" (block).

  • Character device file:

    Character device file is accessed in the form of byte stream. This feature is implemented by the character device driver, which is usually used System calls such as open, close, read, and write. Character terminals, serial ports, keyboards, etc. are character devices. In addition, because character device files are accessed in the form of file streams, they can be read sequentially, but random access is generally not supported. Use the ls -l command to view the first character of the character device file is "c" (char).

4. Link file

Link file generally refers to a soft link (or symbolic link) to a file , use the ls -l command to view, the first symbol is "l", the file name is light blue, as follows:

Why does the green color appear when decompressing a zip file in Linux?

Here, test_softlink is a link file, from You can also see in the result that it is a soft link to the file test.txt. If you delete the original file test.txt, the corresponding soft link file test_softlink will also disappear. You can use the ln command to create a link file of a file:

Soft link

Soft link (also known as symbolic link), use the ln -s file file_softlink command to create Soft link file of a file:

ln -s test.txt test_softlink
Copy after login

软链接相当于给原文件创建了一个快捷方式,如果删除原文件,则对应的软链接文件也会消失。

硬链接

硬链接,相当于给原文件取了个别名,其实两者是同一个文件,删除二者中任何一个,另一个不会消失;对其中任何一个进行更改,另一个的内容也会随之改变,因为这两个本质上是同一个文件,只是名字不同。使用ls -i 命令查看,可以发现硬链接的两个文件的 inode 号是一样的:

Why does the green color appear when decompressing a zip file in Linux?

同样的,使用ln 命令可以创建一个文件的硬链接:

ln test.txt test_hardlink
Copy after login

5. 管道文件

管道文件主要用于进程间通信,使用ls -l 命令查看,第一个字符为 "p"(pipe)。可以使用 mkfifo 命令来创建一个管道文件:

mkfifo fifo_file
Copy after login

Why does the green color appear when decompressing a zip file in Linux?

在FIFO 中可以很好地解决在无关进程间数据交换的要求,FIFO 的通信方式类似于在进程中使用文件来传输数据,只不过 FIFO 类型的文件同时具有管道的特性,在读取数据时,FIFO 管道中同时清除数据。

6. 套接字文件

套接字文件主要用于通信,特别是在网络上。使用ls -l 命令查看,第一个字符为 "s"(socket)。

Why does the green color appear when decompressing a zip file in Linux?

相关推荐:《Linux视频教程

The above is the detailed content of Why does the green color appear when decompressing a zip file in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template