Skip to content

Instantly share code, notes, and snippets.

@GitOffMyCode
Forked from juanarbol/chmodCheatSheet.md
Created November 30, 2019 10:05
Show Gist options
  • Select an option

  • Save GitOffMyCode/ce9bc55a3bfe9f714730d9202b019edd to your computer and use it in GitHub Desktop.

Select an option

Save GitOffMyCode/ce9bc55a3bfe9f714730d9202b019edd to your computer and use it in GitHub Desktop.

Revisions

  1. @juanarbol juanarbol revised this gist Dec 15, 2017. No changes.
  2. @juanarbol juanarbol revised this gist Dec 15, 2017. 1 changed file with 3 additions and 6 deletions.
    9 changes: 3 additions & 6 deletions chmodCheatSheet.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ### How to use chmod codes in UNIX:

    1. There is three types of permisions in files and folders in unix
    1. There are three types of permisions in files and folders in unix
    1. Read (**r**)
    2. Write (**w**)
    3. Execute (**x**)
    @@ -22,8 +22,6 @@ drwxr-xr-x 3 user staff 102 Aug 20 19:14 deploynode

    ### How to read this?

    #### Take the first output:

    Where is a letter put a `1` and where is a `-` put a `0`. Examples:

    | **U** | **G** | **O** |
    @@ -33,16 +31,15 @@ Where is a letter put a `1` and where is a `-` put a `0`. Examples:

    So, user, group and others can read, write and excute the file or folder

    #### Take the second output:

    | **U** | **G** | **O** |
    | ------------- |:-------------:| -----:|
    | r w -| r -- | r - x |
    |1 1 0 | 1 0 0 | 1 0 1|

    So, user can read and write, group and other only can read.
    So, user can read and write, group can only read, finally other can read and execute

    #### As you can see, we can play with these permisions
    #### As you can see, we can play with these permissions

    | **U** | **G** | **O** |
    | ------------- |:-------------:| -----:|
  3. @juanarbol juanarbol revised this gist Aug 23, 2017. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions chmodCheatSheet.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # Chmod codes cheat sheet

    ### How to use chmod codes in unix:
    ### How to use chmod codes in UNIX:

    1. There is three types of permisions in files and folders in unix
    1. Read (**r**)
    @@ -24,6 +24,8 @@ drwxr-xr-x 3 user staff 102 Aug 20 19:14 deploynode

    #### Take the first output:

    Where is a letter put a `1` and where is a `-` put a `0`. Examples:

    | **U** | **G** | **O** |
    | ------------- |:-------------:| -----:|
    | r w x| r w x | r w x |
    @@ -46,6 +48,7 @@ So, user can read and write, group and other only can read.
    | ------------- |:-------------:| -----:|
    | r - x| r w - | - - - |
    |1 0 1 | 1 1 0 | 0 0 0|
    | **U** | **G** | **O** |
    | - w x| r - x | - - x |
    |0 1 1 | 1 0 1 | 0 0 1|

    @@ -65,11 +68,11 @@ So, user can read and write, group and other only can read.
    The sintax is something like this: `$ chmod u/permissions g/permissions o/permissions file[or /dir/]`

    * So, if I run `$ chmod 777 file` <=>
    `rwx rwx rwx` everybody can do anything with file
    `rwx rwx rwx` everybody can do anything with **file**
    * Or I run `$ chmod 744 dir` <=>
    `rwx r-- r--`only user can read, write and execute, group and others only read **dir**.
    * Or run `$ chmod 200 file2` <=>
    `-w- --- ---`only you can write file
    `-w- --- ---`only you can write **file2**

    Thanks for reading, I hope it works! Follow me on [Twita](https://twitter.com/soyjuanarbol) and [GitHub](https://github.com/juanarbol)

  4. @juanarbol juanarbol revised this gist Aug 23, 2017. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions chmodCheatSheet.md
    Original file line number Diff line number Diff line change
    @@ -62,12 +62,14 @@ So, user can read and write, group and other only can read.
    | 110 | 6 | r&nbsp;w&nbsp;- |
    | 111 | 7 | r&nbsp;w&nbsp;x |

    The sintax is something like this: `$ chmod u/permissions g/permissions o/permissions file[or /dir/]`

    * So, if I run `$ chmod 777 file` <=>
    `rwx rwx rwx` everybody can do anything with this file or folder!
    * Or I run `$ chmod 744` <=>
    `rwx r-- r--`only user can read, write and execute, group and others only read.
    * Or run `$ chmod 200` <=>
    `-w- --- ---`only you can write this file or folder
    `rwx rwx rwx` everybody can do anything with file
    * Or I run `$ chmod 744 dir` <=>
    `rwx r-- r--`only user can read, write and execute, group and others only read **dir**.
    * Or run `$ chmod 200 file2` <=>
    `-w- --- ---`only you can write file

    Thanks for reading, I hope it works! Follow me on [Twita](https://twitter.com/soyjuanarbol) and [GitHub](https://github.com/juanarbol)

  5. @juanarbol juanarbol revised this gist Aug 23, 2017. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions chmodCheatSheet.md
    Original file line number Diff line number Diff line change
    @@ -3,13 +3,13 @@
    ### How to use chmod codes in unix:

    1. There is three types of permisions in files and folders in unix
    1.1. Read (**r**)
    1.2. Write (**w**)
    1.3. Execute (**x**)
    1. Read (**r**)
    2. Write (**w**)
    3. Execute (**x**)
    2. And, there is a clasificacion of users called UGO (explained bellow):
    2.1. **U** ~> User (usually, you)
    2.2. **G** ~> Group (eg sudo group)
    2.3 **O** ~> Others
    1. **U** ~> User (usually, you)
    2. **G** ~> Group (eg sudo group)
    3. **O** ~> Others

    When you run `$ ls -l` your output will be something like this:

  6. @juanarbol juanarbol revised this gist Aug 23, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions chmodCheatSheet.md
    Original file line number Diff line number Diff line change
    @@ -62,11 +62,11 @@ So, user can read and write, group and other only can read.
    | 110 | 6 | r&nbsp;w&nbsp;- |
    | 111 | 7 | r&nbsp;w&nbsp;x |

    * So, if I run `$ chmod 777 file`
    * So, if I run `$ chmod 777 file` <=>
    `rwx rwx rwx` everybody can do anything with this file or folder!
    * Or I run `$ chmod 744`
    * Or I run `$ chmod 744` <=>
    `rwx r-- r--`only user can read, write and execute, group and others only read.
    * Or run `$ chmod 200`
    * Or run `$ chmod 200` <=>
    `-w- --- ---`only you can write this file or folder

    Thanks for reading, I hope it works! Follow me on [Twita](https://twitter.com/soyjuanarbol) and [GitHub](https://github.com/juanarbol)
  7. @juanarbol juanarbol revised this gist Aug 23, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions chmodCheatSheet.md
    Original file line number Diff line number Diff line change
    @@ -72,5 +72,5 @@ So, user can read and write, group and other only can read.
    Thanks for reading, I hope it works! Follow me on [Twita](https://twitter.com/soyjuanarbol) and [GitHub](https://github.com/juanarbol)

    Refs:
    http://www.pa.msu.edu/~abdo/unixcc.html
    http://www.yourownlinux.com/2013/09/chmod-basics-of-filesdirectories.html
    1. http://www.pa.msu.edu/~abdo/unixcc.html
    2. http://www.yourownlinux.com/2013/09/chmod-basics-of-filesdirectories.html
  8. @juanarbol juanarbol created this gist Aug 23, 2017.
    76 changes: 76 additions & 0 deletions chmodCheatSheet.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,76 @@
    # Chmod codes cheat sheet

    ### How to use chmod codes in unix:

    1. There is three types of permisions in files and folders in unix
    1.1. Read (**r**)
    1.2. Write (**w**)
    1.3. Execute (**x**)
    2. And, there is a clasificacion of users called UGO (explained bellow):
    2.1. **U** ~> User (usually, you)
    2.2. **G** ~> Group (eg sudo group)
    2.3 **O** ~> Others

    When you run `$ ls -l` your output will be something like this:

    ```
    -rwxrwxrwx@ 1 user staff 708301983 Aug 11 13:51 all.zip
    -rw-r--r-- 1 user staff 0 Aug 22 22:10 chmodCheatSheet.md
    -r--------@ 1 user admin 1692 Jul 6 10:13 deploykey.pem
    drwxr-xr-x 3 user staff 102 Aug 20 19:14 deploynode
    ```

    ### How to read this?

    #### Take the first output:

    | **U** | **G** | **O** |
    | ------------- |:-------------:| -----:|
    | r w x| r w x | r w x |
    |1 1 1 | 1 1 1 | 1 1 1|

    So, user, group and others can read, write and excute the file or folder

    #### Take the second output:

    | **U** | **G** | **O** |
    | ------------- |:-------------:| -----:|
    | r w -| r -- | r - x |
    |1 1 0 | 1 0 0 | 1 0 1|

    So, user can read and write, group and other only can read.

    #### As you can see, we can play with these permisions

    | **U** | **G** | **O** |
    | ------------- |:-------------:| -----:|
    | r - x| r w - | - - - |
    |1 0 1 | 1 1 0 | 0 0 0|
    | - w x| r - x | - - x |
    |0 1 1 | 1 0 1 | 0 0 1|

    ### Finally, the codes! (sorry)

    | Bin | Decimal | Representation |
    | ------------- |:-------------:| -----:|
    | 000 | 0 | -&nbsp;-&nbsp;- |
    | 001 | 1 | -&nbsp;-&nbsp;x |
    | 010 | 2 | -&nbsp;w&nbsp;- |
    | 011 | 3 | -&nbsp;w&nbsp;x |
    | 100 | 4 | r&nbsp;-&nbsp;- |
    | 101 | 5 | r&nbsp;-&nbsp;x |
    | 110 | 6 | r&nbsp;w&nbsp;- |
    | 111 | 7 | r&nbsp;w&nbsp;x |

    * So, if I run `$ chmod 777 file`
    `rwx rwx rwx` everybody can do anything with this file or folder!
    * Or I run `$ chmod 744`
    `rwx r-- r--`only user can read, write and execute, group and others only read.
    * Or run `$ chmod 200`
    `-w- --- ---`only you can write this file or folder

    Thanks for reading, I hope it works! Follow me on [Twita](https://twitter.com/soyjuanarbol) and [GitHub](https://github.com/juanarbol)

    Refs:
    http://www.pa.msu.edu/~abdo/unixcc.html
    http://www.yourownlinux.com/2013/09/chmod-basics-of-filesdirectories.html