DEV Community

Nadim Chowdhury
Nadim Chowdhury

Posted on • Edited on

What is chmod numbers in linux?

In Linux, chmod is a command used to change the permissions of files and directories. Permissions determine who can read, write, and execute a file.

The permissions are represented by three groups: owner, group, and others. Each of these groups has three types of permissions: read (r), write (w), and execute (x).

To change permissions using chmod, you can use either symbolic mode or numeric mode. In numeric mode, permissions are represented by three octal digits:

  1. The first digit represents the permissions for the owner.
  2. The second digit represents the permissions for the group.
  3. The third digit represents the permissions for others.

Each digit is a combination of the following values:

  • 4 for read permission (r)
  • 2 for write permission (w)
  • 1 for execute permission (x)

You add these values together to assign permissions. For example:

  • 7 = 4 (read) + 2 (write) + 1 (execute) = full permissions (rwx)
  • 6 = 4 (read) + 2 (write) = read and write permissions (rw-)
  • 5 = 4 (read) + 1 (execute) = read and execute permissions (r-x)
  • 4 = 4 (read) = read-only permissions (r--)
  • 0 = No permissions (--)

So, when you use chmod with numeric mode, you specify the desired permission using these digits. For example, to give read, write, and execute permissions to the owner, read and execute permissions to the group, and only execute permission to others, you would use:

chmod 751 filename
Enter fullscreen mode Exit fullscreen mode

This would set the permissions as follows:

  • Owner: rwx (7)
  • Group: r-x (5)
  • Others: --x (1)

Support My Work ❤️

If you enjoy my content and find it valuable, consider supporting me by buying me a coffee. Your support helps me continue creating and sharing useful resources. Thank you!

Connect with Me 🌍

Let’s stay connected! You can follow me or reach out on these platforms:

🔹 YouTube – Tutorials, insights & tech content

🔹 LinkedIn – Professional updates & networking

🔹 GitHub – My open-source projects & contributions

🔹 Instagram – Behind-the-scenes & personal updates

🔹 X (formerly Twitter) – Quick thoughts & tech discussions

I’d love to hear from you—whether it’s feedback, collaboration ideas, or just a friendly hello!

Disclaimer

This content has been generated with the assistance of AI. While I strive for accuracy and quality, please verify critical information independently.

Top comments (0)