- 1View File Permissions in Linux
- 2Change File Permissions with chmod in Linux
- 3How to Use Numeric Mode with chmod in Linux
- 4chmod Symbolic Mode in Linux
- 5How to Change File Ownership in Linux
- 6How to Change Group Ownership Using chgrp in Linux
- 7Understanding Linux File Permission Symbols (r, w, x)
- 8Linux File Permissions - User, Group, Others
- 9Understanding Special Permissions in Linux: SUID, SGID, and Sticky Bit
- 10How to Use ACLs in Linux - Set File Permissions
- 11Set ACL Permissions in Linux with setfacl
- 12How to View ACLs using getfacl in Linux
- 13Find Files by Permissions in Linux
How to Use Numeric Mode with chmod
How to Use Numeric Mode with chmod
Welcome to this Linux tutorial! Today, we're going to learn how to use numeric mode with the chmod
command to change file permissions. If you're just getting started with Linux, this lesson will give you a clear and beginner-friendly explanation of numeric (octal) permission values.
🎯 Why chmod Numeric Mode?
In Linux, every file and directory has permission settings that control who can read, write, or execute them. You can change these permissions using the chmod
command. There are two main ways to use chmod
:
- Symbolic mode (like
chmod u+x file.txt
) - Numeric mode — this is what we’re covering in this tutorial
🔢 What Do the Numbers Mean?
Each permission is assigned a number:
r
(read) = 4w
(write) = 2x
(execute) = 1
You add these values together to represent permissions. For example:
7
= read + write + execute (4 + 2 + 1)6
= read + write (4 + 2)5
= read + execute (4 + 1)
Permissions are grouped into three categories:
- User (owner)
- Group
- Others
So when you see a command like:
chmod 755 script.sh
You're saying:
- User: 7 (read, write, execute)
- Group: 5 (read, execute)
- Others: 5 (read, execute)
📂 Let’s Try It Step-by-Step
Step 1: Create a test file
touch myfile.txt
Step 2: View the current permissions
ls -l myfile.txt
-rw-r--r-- 1 user user 0 Jul 2 12:34 myfile.txt
Step 3: Now change permissions to 764
chmod 764 myfile.txt
Step 4: View the updated permissions
ls -l myfile.txt
-rwxrw-r-- 1 user user 0 Jul 2 12:34 myfile.txt
This means:
- User: 7 (read, write, execute)
- Group: 6 (read, write)
- Others: 4 (read only)
🧠 Pro Tip
If you're ever unsure about what a number means, just break it into parts:
- First digit = user
- Second digit = group
- Third digit = others
So, chmod 640 file
gives:
- User: 6 (read, write)
- Group: 4 (read only)
- Others: 0 (no permissions)
✅ Summary
That's it! You now know how to use numeric mode with chmod
. It’s quick, powerful, and once you get used to the numbers, it becomes second nature.
Try changing permissions on a few test files to get comfortable. You'll be mastering Linux file permissions in no time!
Comments
Loading comments...