File Permission

Command
Description
Example

chmod [mode] [file]

Change file permissions.

chmod 755 file.txt → Sets permissions to rwxr-xr-x.

chown [owner] [file]

Change file ownership.

sudo chown user file.txt → Sets user as the owner of file.txt.

chgrp [group] [file]

Change file group.

sudo chgrp developers file.txt → Sets developers as the group for file.txt.

ls -l

View file permissions.

ls -l → Displays detailed file permissions for each file.

umask

Set default file permissions for new files.

umask 022 → Ensures new files are created with rw-r--r-- permissions.

Last updated