
上QQ阅读APP看书,第一时间看更新
The chmod command
To change the permissions of a file, you need to use the chmod command, chmod <letters> <file or directory>. You can also use an octal format instead of letters, chmod <octal format> <file or directory>. To convert the permission from the letters format to the octal format, you need to convert every permission into a value:

Now, let's take an example and see how to use the chmod command with the octal format in an easy way. Let's suppose that we need to give the user the permission to read and write, the group only to read, and others only to execute. Then, the octal format will be 641, because:
- User: Read + Write = 6
- Group: Read = 4
- Other: Execute = 1
The final command will be: chmod 641 <file>