This post is designed to record the instructions that are often tested under Linux.
1, chmod
The chmod command is used to change permissions for a file or directory. The common syntax is as follows:
chmod [who] [+ |-| =] [mode] File name
The meanings of the options in the command are:
U represents "User", which is the owner of a file or directory.
g means "same group of users", that is, all users who have the same group ID as the owner of the file.
o Represents "other (others) users".
a represents "all users". It is the system default value.
The action symbol can be:
+ Add a permission.
-Cancels a permission.
= gives the given permission and cancels all other permissions, if any.
The following is an analysis of the user rights for Linux files:
Examples are as follows:
Modify a.cpp for writable readable executable:
chmod 777 A.cpp
Delete A.cpp other groups can write executable, belong to the group executable:
chmod g-x o-wx A.cpp
Delete all (including owner, Group, others) executable:
chmod a-x a.cpp
or
chmod-x a.cpp
To set the owner-readable writable executable:
chmod u=rwx A.cpp
Note not o = 777!!!
To modify the properties of all CPP files:
chmod 777 *.cpp
Modify all file attributes (excluding subdirectories) in the directory to write-readable executable:
chmod 777 *.*
You can replace the folder name with the suffix name.
To modify all folder properties under the directory:
chmod 777 *
Replace the folder name with *.
To modify the current folder properties:
chmod 777.
Modify the directory/images/xiao to be writable and readable:
chmod 777/images/xiao
To modify all files and folders and subfolder properties in a folder to be writable and readable:
Chmod-r 777/images/xiao