Lessons
09Permissions and scripts
0 of 7 tasks

Lesson 09 · about 14 min · 7 tasks

Permissions and scripts

Read who can do what to a file, run your own scripts, and keep private files private.

step 1 of 7

Read the permissions

Every file has rules about who may read it, change it and run it. ls -l (a lowercase L, for “long”) shows them:

$ ls -l scripts
total 8
-rw-r--r--  1 you  you    141 Oct 21 09:14 backup.sh
-rw-r--r--  1 you  you     40 Oct 21 09:14 hello.sh

The first column is the one that matters. Skip the first character (- for a file, d for a folder) and read the rest in three groups of three:

  • rw- is what you, the owner, can do: read and write
  • r-- is what your group can do: read only
  • r-- is what everyone else can do: read only

r is read, w is write, x is execute (run it as a program), and - means no. Then come the owner’s name, the group, the size in bytes, and when it last changed.

Your turn, in the terminal

  • Show the permissions of the files in scripts
mapfolders appear as you explore
/ …
home/ …
you/◂ you are here
nowShow the permissions of the files in scripts
terminal
Practice terminal. Nothing you do here touches your real computer.
Type help to see what it understands.
you@terminal-mastery:~$