Changes

Jump to: navigation, search

ULI101 Week 4

123 bytes added, 21:30, 4 September 2019
no edit summary
* Convert the binary number <code>111110000</code> to an octal number:
<pre class="example">= 1 1 1 1 1 0 0 0 0x 2^2 2^1 2^0 2^2 2^1 2^0 2^2 2^1 2^0i.e. (4) (2) (1) (4) (2) (1) (4) (2) (1)1x4+ 1x2+ 1x1 1X4+ 1x2+ 0x1 0X4+ 0x2+ 0x1= (4+2+1) = 7 (4+2+0) = 6 (0+0+0) = 0
</pre>
Therefore, the binary number 111110000 represents 760 as an octal number. This code can be used to represent directory and file permissions (you will learn how to set permissions soon)
* Convert the binary number <code>111110000</code> to a hexadecimal number:
<pre class="example">= 0 0 0 1 1 1 1 1 0 0 0 0(8) (4) (2) (1) (8) (4) (2) (1) (8) (4) (2) (1)1 15 01 F 0
</pre>
Therefore, the binary number <code>111110000</code> represents <code>1F0</code> as a hexadecimal number.
<blockquote>1 hexadecimal digit is equal to 4 binary digits. Group binary digits into groups of 4 starting from the right. Add leading zeros if last group of digits is less than 4 digits. Convert each group of 4 digits to a hexadecimal digit.
</blockquote>
 
=== Converting Hex to Binary ===
<pre class="example"> 1 F 0
= 1 15 0= (8)(4)(2)(1) (8)(4)(2)(1) (8)(4)(2)(1)= 0 0 0 1 1 1 1 1 0 0 0 0
= 000111110000 = 111110000
</pre>
-rw-rw---- 1 joe.professor users 0 2006-02-02 10:47 ~/work_together
# This indicates the user “joe.professor” owns the file “work_together”.
# The owner “joe.professor” can read and write to that file.“work_together”# By the way, you joe.professor can change the ownership of files work_together (using the chown command, assuming you own them).
# Let’s look at the detailed listing for a regular file owned by someone else:
-rw-rw---- 1 joe.professor users 0 2006-02-02 10:47 ~/work_together
# This indicates a group name (called “users”) that is assigned to that file “work_together”.# In this case the user “joe.professor” has given permission to other users that belong to theanyone in “users” group# “users” group to read from and write to (incl. delete) the file “work_together”.
[joe.professor] ls -l ~/work_together
# Answer: all “other” users - users that DO NOT belong to the “users” group.!
</pre>
 
= Directory Permissions =
* For ordinary files any execute permissions are no applied
* For example: umask 310 would result in permissions 466 (r--rw-rw-)
 
[[Category:ULI101]]
[[Category:ULI101-2018]]

Navigation menu