> For the complete documentation index, see [llms.txt](https://devops-3.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devops-3.gitbook.io/devops/docs/linux-cheat-sheet/file-permission.md).

# File Permission

| Command                                                    | Description                                 | Example                                                                     |
| ---------------------------------------------------------- | ------------------------------------------- | --------------------------------------------------------------------------- |
| <mark style="color:red;">**chmod \[mode] \[file]**</mark>  | Change file permissions.                    | chmod 755 file.txt → Sets permissions to rwxr-xr-x.                         |
| <mark style="color:red;">**chown \[owner] \[file]**</mark> | Change file ownership.                      | sudo chown user file.txt → Sets user as the owner of file.txt.              |
| <mark style="color:red;">**chgrp \[group] \[file]**</mark> | Change file group.                          | sudo chgrp developers file.txt → Sets developers as the group for file.txt. |
| <mark style="color:red;">**ls -l**</mark>                  | View file permissions.                      | ls -l → Displays detailed file permissions for each file.                   |
| <mark style="color:red;">**umask**</mark>                  | Set default file permissions for new files. | umask 022 → Ensures new files are created with rw-r--r-- permissions.       |
