chmod

Linux · Users and permissions · available in the simulator

What it does

Changes file or directory access permissions.

Syntax

chmod [opciones] modo archivo...

Options and parameters

  • -R

    Changes files and directories recursively.

    chmod -R 755 carpeta
  • u/g/o/a

    Target: user, group, others, or all.

    chmod u+x script.sh
  • +/-/=

    Adds, removes, or sets exact permissions.

    chmod go-w archivo.txt
  • r/w/x

    Read / write / execute.

  • -v

    Outputs a diagnostic for every file processed.

  • 755

    Octal notation: 4 read, 2 write, 1 execute, for owner, group, and others.

    chmod 644 archivo.txt

Usage examples

  • chmod 755 script.sh
  • chmod +x script.sh
  • chmod -R u+w carpeta/
  • chmod o-r privado.txt
  • chmod 644 archivo.txt
  • chmod -R u+rwX,go+rX carpeta/
  • chmod -R 755 carpeta
  • chmod u+x script.sh
  • chmod go-w archivo.txt
Practise chmod

Related commands