File management skills in CentOS

Source: Internet
Author: User
Since I have been studying Linux for a long time, I hope to help you with file management skills in Linux. Linux assigns a file owner to each file, called the file master, and assigns the file master a unique registration name. File control depends on the file master or super user (root ). The creator of a file or directory has a special right to use the created file or directory. all relations of the file can be changed. you can take ownership of the file or directory.

Since I have been studying Linux for a long time, I hope to help you with file management skills in Linux. Linux assigns a file owner to each file, called the file master, and assigns the file master a unique registration name. File control depends on the file master or super user (root ).

The creator of a file or directory has a special right to use the created file or directory. all the relationships of the file can be changed. you can transfer the ownership of the file or directory to other users, however, only the file owner or root has the right to change all file relationships.

Users can be user names or user IDs. A file is a list of files separated by spaces to change permissions. the file name can be expressed with wildcards. If the ownership of a file or directory is changed, the original file owner no longer has the permission to the file or directory. The system administrator often uses the chown command to grant the user the permission to use the file after copying the file to another user's directory.

The ownership mark of the file is the user ID (UID ). Chown command to change the ownership of a file or directory. For example, a super user copies a file to xu. to allow xu to access the file, the super user (root) should set the owner of the file to xu, otherwise, xu cannot access this file. The syntax format of the chown command is:

Chown [option] user or group file 1 [File 2…]

In Linux, each file belongs to a user group at the same time. When you create a file or directory, the system will assign it a user group relationship. all members of the user group can use this file or directory. The Mark of the file user group relationship is GID. The GID of a file can only be modified by the file owner or root user. The chgrp command can change the GID of a file. the syntax format is:

Chgrp [option] group file name, where group is the user group ID. The file name is a list of files separated by spaces to change the group. it supports wildcards.

In a Linux operating system, each file and directory has access permission to determine who can access and operate files and directories. There are three different types of users with access permissions: File owners, users in the same group, and users who can access the system (others ).

When you use the ls-l command or the l command to display detailed information about a file or directory, the leftmost column lists the file access permissions. The meanings of these methods are as follows: access permissions are required to access files or directories in three ways: Read (r), write (w), executable or search (x ). Add the-d option after the ls command to view the permission to use directory files: ls-d

Read permission (r) can list the files stored in this directory, that is, the Read directory content list. This permission allows shell to use file extension characters to list matched file names. write permission (w) allows you to delete or add new files from the directory, generally, only the directory owner has the write permission. the execution permission (x) allows you to search in the directory and change the working directory to the Directory using the cd command.

File access permission

Read permission (r) indicates that only the specified user is allowed to read its content, and any changes to it are prohibited. You must have the read permission to use the content of the Accessed file as the input command. For example, cat and more; write permission (w) indicates that the specified user is allowed to open and modify files. For example, command vi and cp. the execution permission (x) allows the specified user to execute the file as a program.

Related Article

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.