Know How to Use the chmod Command on Linux in Two Minutes
- Understand permissions
- how to check ($ls -l)
- file (-)
- dir (d)
- read (r)
- write (w)
- execute (x)
- User types
- user (u)/group (g)/other (o)
- Understand operations
- + (add)
- - (remove)
- = (set equal)
- Numerical shorthand
- The digits you can use and what they represent are listed here:
- 0: (000) No permission. 1: (001) Execute permission.
- Recursive (-R)
- If we had wanted to include files in subdirectories, we could have used the -R (recursive) option.
- Examples
- $ls -l
- $chmod 777 chmod_test.txt
- $chmod u-x chmod_test.txt
- 2: (010) Write permission.
- 3: (011) Write and execute permissions.
- 4: (100) Read permission.
- 5: (101) Read and execute permissions.
- 6: (110) Read and write permissions.
- 7: (111) Read, write, and execute permissions.
No comments:
Post a Comment