Changing Permissions (chmod)

The "chmod" command is a Linux/Unix command used to change the permissions of files or directories. The command is short for "change mode". With "chmod", you can specify who can read, write, and execute a file or directory. Here's the basic syntax for the "chmod" command:

chmod [permissions] [filename/directory]

Symbolic notation:

chmod u+rwx file.txt    // add read, write, and execute permission for the owner
chmod g-w file.txt      // remove write permission for the group
chmod o=r file.txt      // set read permission for others

Numeric notation:

r=4, w=2, x=1

chmod 750 file.txt      // set read, write, and execute permission for the owner, read and execute permission for the group, and no permission for others
chmod 644 file.txt      // set read and write permission for the owner, and read-only permission for the group and others
chmod 777 file.txt      // set read, write, and execute permission for everyone (not recommended for security reasons)

Last updated