What does the 'chmod' command do?

QuestionsQuestions8 SkillsProHello, Bash!Nov, 02 2025
0246

The chmod command is used to change the file permissions in a Unix-like operating system. It allows you to specify who can read, write, or execute a file. The permissions can be set for three categories of users:

  1. User (u): The owner of the file.
  2. Group (g): Users who are part of the file's group.
  3. Others (o): All other users.

You can use symbolic or numeric modes to set permissions. For example:

  • To add execute permission for the user:

    chmod u+x filename
  • To remove write permission for others:

    chmod o-w filename
  • To set permissions using numeric mode (e.g., 755):

    chmod 755 filename

In this case, 7 gives read, write, and execute permissions to the user, 5 gives read and execute permissions to the group, and 5 gives read and execute permissions to others.

0 Comments

no data
Be the first to share your comment!