LINUX constant test instruction (update) __linux

Source: Internet
Author: User
Tags chmod readable

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




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.