chmod

Linux chmod command syntax

Function:Use chmod to control how files are called by others.

Permissions:All users

Syntax:chmod [-cfvR] [--help] [--version] mode file.. .

Linux chmod command example

Set the file file1.txt to be readable by everyone:

chmod ugo+r file1.txt

Set the file file1.txt to be readable by everyone:

chmod a+r file1.txt

Make the file file1.txt With file2.txt set as the owner of the file, people in the same group as it can write, but others cannot write:

chmod ug+w,o-w file1.txt file2.txt

Set ex1.py as only the owner of the file You can execute:

chmod u+x ex1.py

Set all files and subdirectories in the current directory to be readable by anyone:

chmod -R a+r *

In addition, chmod can also use numbers to represent permissions, such as:

chmod 777 file

The syntax is:

chmod abc file