Learn

Within the file permissions are controls for the three main actions that can be performed on a file: reading, writing, and executing. These permissions differ by user as well as collections of users called groups.

In Unix operating systems, the permissions for a file are represented using a line of 10 characters. The first character can either be - for a file or d for a directory. The other 9 characters are separated into three equal parts called triads.

The first triad containing the first free characters contains the permissions for the owner, the second triad contains the permissions for the group, and the third triad contains the permissions for any other user outside of this.

Each of these three characters within a triad are flags indicating a permission. r means that the file is readable, w means that the file is writable, and x means that the file is executable.

Instructions

To the right is a directory from a Linux operating system showing the permissions for a variety of files:

  • For apple, -rw------- means that the file is readable and writable for only the owner.
  • For banana, -rw-rw-rw- means that the file is readable and writable for all users on the system.
  • For cranberry, -rwxrwxrwx means that the file is readable, writable, and executable for all users on the system.
  • For pear, -rw-r--r-- means that the file is readable and writable for the owners, but only readable for everybody else.
  • For raspberry, -r--r--r-- means that the file is read only.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?