Living in the Shell #24; chmod (Modify file/directory permissions)

chmod ๐
Modifies file/directory permissions (See here or here for more details).
Permission expressions are mostly formatted as [ugoa][+-=][rwx]:
| Symbol | Meaning |
r | Read |
w | Write |
x | Execute |
| Symbol | Meaning |
u | User (owner of the file/directory) |
g | Group (of the file/directory) |
o | Other users/groups |
a | All users/groups |
Grant all permissions to everyone; a+rwx or 777
chmod a+rwx some-file
# or
chmod 777 some-file
Make a file executable for everyone +x
chmod +x some-file
# or
chmod a+x some-file
Make a file executable only for the User (owner) u+x
chmod u+x some-file
Disallow Group and Others to read/write/execute go-rwx
chmod go-rwx some-file
Apply the same User (owner) permissions to the Group =u
chmod g=u some-file
Rewrite permissions for the Group and Others =
chmod go=rw some-file
Clear permissions for the Group and Others =
chmod go= some-file
Clear all permissions =
chmod a= some-file
About Living in the Shell
Obsessed with doing things in the shell, Iโve decided to share my daily struggles on living in the shell as terse but informative posts.
![Godoc-Lint: a linter for Go Doc Comments (godocs) [RE#16]](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1741533596295%2F731ef95a-1af8-49ae-843d-a19d9d418fdf.png&w=3840&q=75)
![Optimize Postgres Containers for Testing [RE#15]](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1741533395875%2Fe1a3c4fc-4354-4482-88b8-e8c14750e00a.png&w=3840&q=75)
