Home  >  Article  >  Operation and Maintenance  >  What does linux executable mean?

What does linux executable mean?

青灯夜游
青灯夜游Original
2022-04-15 14:32:245120browse

There are two meanings of executable in Linux: 1. For a file, it means that the file has the permission to be executed by the system; whether the file can be executed depends on whether the file has x permission. If Some files are executable files. 2. For directories, the representative user can enter the directory, and users with x permissions can use the cd command to switch directories.

What does linux executable mean?

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

Everything in Linux is a file, folders, newly added hard disks... can all be processed by looking at files. They all have permissions, which are read, write and executable.

But in fact, the same permissions have different meanings for files and directories

The effects of read (r), write (w), and executable (x) permissions on files

Files are used to store data in the system, including ordinary text files, database files, binary executable files, etc. The meaning of different permissions on files is shown in Table 1.

Table 1 The role of rwx permissions on files
rwx permissions The role of rwx permissions on files
Read permission (r) means that the actual content in this file can be read. For example, you can execute file viewing commands such as cat, more, less, head, and tail on the file.
Write permission (w) means that you can edit, add or modify the contents of the file. For example, you can execute vim, echo, etc. on the file to modify the file data. Order. Note that no permission does not give the user the right to delete the file unless the user has write permission to the file's parent directory.
Execution permission (x) indicates that the file has the permission to be executed by the system. In Windows systems, checking whether a file is an executable file is based on the extension (.exe, .bat, etc.), but in Linux systems, whether a file can be executed is determined by checking whether the file has x permissions. That is, as long as the file has x permissions, the file is executable. However, whether the file can run correctly depends on whether the code in the file is correct.

For files, execution permission is the highest permission. When setting permissions for users or groups, you need to carefully consider whether to grant execution permissions, otherwise it will seriously affect the system installation.

The effect of read (r), write (w), and executable (x) permissions on the directory

Directory, mainly used to record the file name list, different The effects of permissions on directories are shown in Table 2.

Table 2 The effect of rwx permissions on the directory
rwx permissions The effect on the directory
Read permission (r) indicates the permission to read the directory structure list, that is, you can see what files and subdirectories are in the directory. Once you have r permissions on a directory, you can execute the ls command in this directory to view the contents of the directory.
Write permission (w) For directories, w permission is the highest permission. Having w permission on the directory means that you can do the following operations on the directory:
  • Create new files or subdirectories in this directory;
  • Delete existing files and directories (regardless of subfiles or What are the permissions of subdirectories);
  • Rename existing files or directories;
  • Move the location of files and directories in this directory.
Once you have w permission on the directory, you can execute commands such as touch, rm, cp, mv and so on in the directory.
Execution permission (x) The directory cannot be run directly. Granting x permissions to the directory means that the user can enter the directory, that is, giving x permissions A user or group can use the cd command.

Note:

For a directory, if only r permission is granted, this directory cannot be used. It's very simple. For a directory with only r permissions, the user can only view the directory structure and cannot enter the directory at all (x permissions are required), let alone use it.

Therefore, for directories, there are actually only three permissions commonly used to set directories: 0 (---), 5 (r-x), and 7 (rwx).

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What does linux executable mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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