Menu
Coddy logo textTech

Chmod With Symbols

Part of the Fundamentals section of Coddy's Terminal journey — lesson 56 of 82.

Symbolic mode offers a more intuitive way to use chmod. Instead of calculating numbers, you specify exactly what you want to change using letters and symbols.

The format is: chmod WHO OPERATOR PERMISSION file

For WHO, use: u (user/owner), g (group), o (others), or a (all three).

For OPERATOR, use: + (add), - (remove), or = (set exactly).

For PERMISSION, use: r (read), w (write), or x (execute).

Here are some examples:

# Add execute permission for the owner
chmod u+x script.sh
# Remove write permission from others
chmod o-w document.txt
# Give group read and execute permissions
chmod g+rx program.sh
# Set exact permissions for all users
chmod a=r readme.txt

The symbolic method shines when you want to modify a single permission without affecting the others. With chmod u+x, you add execute for the owner while keeping all other permissions unchanged. This is often more convenient than recalculating the entire numeric value.

challenge icon

Challenge

Easy

You have a script file setup.sh that currently doesn't have execute permission. Use chmod with symbolic mode to add execute permission for the owner only.

Use the symbolic format with u for user/owner, + to add permission, and x for execute.

After modifying the permissions, use ls -l setup.sh to verify the change.

Your output should show the permission string -rwxr--r-- for the file, indicating the owner now has execute permission while group and others retain only read access.

Hint: Run chmod u+x setup.sh to add execute permission for the owner, then ls -l setup.sh to display the updated permissions.

Cheat sheet

Symbolic mode for chmod uses letters and symbols to modify permissions:

Format: chmod WHO OPERATOR PERMISSION file

WHO:

  • u - user/owner
  • g - group
  • o - others
  • a - all three

OPERATOR:

  • + - add permission
  • - - remove permission
  • = - set exact permission

PERMISSION:

  • r - read
  • w - write
  • x - execute

Examples:

# Add execute permission for the owner
chmod u+x script.sh

# Remove write permission from others
chmod o-w document.txt

# Give group read and execute permissions
chmod g+rx program.sh

# Set exact permissions for all users
chmod a=r readme.txt

Symbolic mode is useful for modifying specific permissions without affecting others.

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals