*** Gap has quit (None) | 10:21 | |
*** dcammue has quit (Quit: Leaving) | 10:48 | |
mulbah | Hello tboimah | 12:43 |
---|---|---|
tboimah | How are you doing mulbah | 12:48 |
mulbah | good and you | 12:49 |
tboimah | I'm fine | 12:50 |
tboimah | Good morning ubuntourist | 13:03 |
mulbah | Good morning Mr. Cole | 13:03 |
mulbah | How are you doing | 13:03 |
ubuntourist | tboimah, mulbah, Hi! I'm well. How are you gents? | 13:03 |
tboimah | I am good | 13:03 |
mulbah | I am good as well | 13:04 |
ubuntourist | And are you both caught up with each other? Both comfortable with script, scriptreplay, dpkg, dpkg-query, apt-cache and chmod? | 13:05 |
ubuntourist | (And were you able to see my recent e-mail talking a bit more about "executables" and chmod?) | 13:05 |
tboimah | yeah | 13:05 |
mulbah | yeah | 13:05 |
ubuntourist | Excellent! One thing that I notice while you are typing: You do not make enough use of the shortcuts that will speed up your typing. | 13:06 |
ubuntourist | Start using TAB more to see if it will finish your typing for you. If it does nothing, try pressing it twice in rapid succession. | 13:07 |
ubuntourist | That will often offer up a few suggestions. | 13:07 |
mulbah | okay Mr. Cole can I ask a question on the Chmod command | 13:08 |
tboimah | oKay | 13:08 |
ubuntourist | Also, when you are trying to repeat a command that you've typed recently, instead of using up-arrow and down-arrow a lot, try "Ctrl-R" | 13:08 |
ubuntourist | and type a small part of the command you are trying to recall. For example "Ctrl-Rfin" will probably show you your last "find" command. | 13:09 |
ubuntourist | OK, mulbah, ask about chmod. | 13:09 |
mulbah | yeah I want to understand the numerical way of using the chmod command you only talk about the alphabetical way of using it | 13:11 |
ubuntourist | mulbah, I sent e-mail about the numeric way. | 13:12 |
mulbah | okay | 13:12 |
mulbah | I haven't check my email yet | 13:12 |
mulbah | but I check it after the class | 13:12 |
mulbah | thanks | 13:12 |
ubuntourist | That's why I asked if you had seen my e-mall message about executables and chmod. | 13:12 |
ubuntourist | You may have more questions after you read that, because it involves a little bit of understanding binary and octal counting. | 13:13 |
ubuntourist | I don't know if either of you have been exposed to that yet. I am guessing that you have not encountered either. | 13:14 |
ubuntourist | Am I correct? | 13:14 |
ubuntourist | Or do you already know about binary, octal, and hexadecimal? | 13:14 |
mulbah | not that much | 13:15 |
tboimah | _1 | 13:15 |
tboimah | -1 | 13:15 |
mulbah | Jeff talk about it ever since the time he was in liberia | 13:15 |
mulbah | here | 13:15 |
ubuntourist | OK. Let's take a detour and talk about that. Binary is REALLY important to programmers, and helpful to sys admins. | 13:16 |
tboimah | okay | 13:16 |
ubuntourist | It comes up a lot. The basics of logic, modern electronics, and computers is binary. | 13:16 |
ubuntourist | In fact, hold on a second... Decades ago, I wrote something about it for another student. I think I may still have the document... | 13:17 |
ubuntourist | Let me check quickly. | 13:17 |
ubuntourist | Well. I found it... But something got damaged in it. So it is not as clear as I want it to be. | 13:19 |
ubuntourist | https://ubuntourist.codeberg.page/pdp-11/ | 13:20 |
ubuntourist | (I will try to fix it. It was written for a student who became my girlfriend. And it talks about a very old computer, not Linux. | 13:20 |
ubuntourist | but in the beginning of the document, it tries to explain binary.) | 13:21 |
tboimah | Wow | 13:22 |
ubuntourist | So. Logic. In formal logic, there are only two conditions: An assertion can be TRUE, or it can be FALSE. | 13:22 |
ubuntourist | In magnetism, a magnet has a NORTH and a SOUTH | 13:22 |
ubuntourist | A light switch can be ON or OFF | 13:22 |
ubuntourist | In computers, we represent these ideas with numbers: 0 = OFF, or FALSE, or DISABLED. 1 = ON, or TRUE, or ENABLED. | 13:23 |
ubuntourist | zero and one. The basis of binary. | 13:24 |
ubuntourist | Often, you have several conditions you want to know about simultaneously: For example, you may only want to go outside | 13:25 |
ubuntourist | if the temperature is good AND it is not raining. Two conditions: Is temperature good TRUE, and is raining FALSE? | 13:26 |
ubuntourist | The condition would be represented numerically as 10. | 13:27 |
ubuntourist | (I should say, it COULD be represented numerically as 10. This is one way of representing the first condition is TRUE and the second is FALSE.) | 13:28 |
ubuntourist | So, that's very basic logic. We'll get into it more later, but you can also see it covered in my other online book for Jeff's class: | 13:30 |
ubuntourist | https://ubuntourist.codeberg.page/Altair-8800/ | 13:30 |
ubuntourist | Math: As children we learn to count on our fingers. Ten fingers. So we use a counting system based on ten. That system is decimal. | 13:31 |
ubuntourist | Have you both had basic algebra? If I say "ten squared", "ten cubed", "ten to the power of five" do you know what those mean? | 13:32 |
mulbah | yeah | 13:34 |
ubuntourist | (There may be regional differences in the words you've learned. I tutored a woman from South America and she used different words for the same concepts.) | 13:34 |
ubuntourist | GREAT. That will speed this up. | 13:34 |
tboimah | +1 | 13:34 |
ubuntourist | So, Any number to the power of zero is one. 15 to the zeroth power is one. 3647 to the zeroth power is one, etc. | 13:35 |
mulbah | sure | 13:35 |
tboimah | sure | 13:35 |
mulbah | and any number to the one power is equal to that number | 13:36 |
ubuntourist | In decimal, the "unit" position or "ones" position is zero through nine, raised to the power of zero. The "tens" position is zero through nine to the power of one. | 13:36 |
ubuntourist | The "hundreds" position is zero through nine to the power of two, and so on, and so on. | 13:37 |
ubuntourist | In BINARY, we use two instead of ten. | 13:37 |
ubuntourist | So: 1010 equals 1**3 + 0**2 + 1**1 + 0**0 equals, in decimal 8 + 0 + 2 + 0 = ten | 13:39 |
ubuntourist | (I'm using ** to mean "raised to the power of") | 13:39 |
mulbah | okay | 13:40 |
mulbah | ** is also use in python like that too | 13:40 |
ubuntourist | I didn't know how far jeff had gotten. If you already know some Python, this will go even faster. | 13:41 |
tboimah | it is an operator sign with stand for exponent | 13:42 |
ubuntourist | When you get really long binary numbers -- for example 111011101 -- it becomes hard to keep track of all the ones and zeros | 13:42 |
ubuntourist | So starting from the RIGHT, we often group the numbers into groups of three or four digits. The example above, broken into three digits is: | 13:43 |
ubuntourist | 111 011 101 | 13:43 |
ubuntourist | (If we were to try converting it to a decimal number, using powers of two, the value would be 477. But we're going to use it a different way.) | 13:44 |
ubuntourist | You can experiment in Python. Let's crank up a tmate session. | 13:45 |
ubuntourist | ACTION waits for tmate. | 13:45 |
mulbah | so if you group it int two it will not work too | 13:45 |
mulbah | ssh dsmSLBpzzTjdy5eehPAxNWvGh@lon1.tmate.io | 13:45 |
tboimah | ssh Eu9XqwbHakaMbh7gmpr4uh4wC@nyc1.tmate.io | 13:45 |
ubuntourist | mulbah, tboimah which one? | 13:46 |
tboimah | you can join both and see what we two are doing | 13:46 |
ubuntourist | OK... | 13:46 |
ubuntourist | So, start python and type: | 13:48 |
ubuntourist | x = 0b111011101 | 13:48 |
ubuntourist | python3 | 13:48 |
tboimah | done | 13:48 |
ubuntourist | print(x) | 13:49 |
tboimah | wow it give 477 | 13:49 |
ubuntourist | So, In Python, you can enter binarary numbers usiing 0b followed by ones and zeros. | 13:50 |
ubuntourist | And when you print, it will print the decimal equivalent of the number. | 13:50 |
mulbah | so what entering 0b really matter | 13:50 |
mulbah | or What 0b really do | 13:51 |
ubuntourist | Try another. It doesn't need to be a big number. "0b" means, the numbers that come after this can only be zeros and ones, and it should be interpreted as a BINARY value, not a DECIMAL value. | 13:52 |
mulbah | okay | 13:52 |
ubuntourist | Try 0b10, and 0b100, and 0b1000. I mean "x =" and "print(x) with those values. | 13:53 |
ubuntourist | Do you understand what is happening? | 13:54 |
mulbah | yeah | 13:54 |
tboimah | still a little bet confuse | 13:54 |
mulbah | 101 means 5 in binary and 111 means 7 | 13:55 |
ubuntourist | tboimah, in the examples you typed, can you think of how 2, 4, and 8 are related? | 13:55 |
ubuntourist | mulbah, right. | 13:56 |
tboimah | Ahh okay | 13:56 |
ubuntourist | mulbah, actually, almost right: We would say that 101 binary is 5 decimal, and 111 binary is 7 decimal. | 13:57 |
mulbah | in my code I side print(b, x) so it print b first | 13:57 |
ubuntourist | 0 binary is 0 decimal, 1 binary is 1 decimal, 10 binary is 2 decimal, 100 binary is 4 decimal, 1000 binary is 8 decimal. | 13:58 |
ubuntourist | mulbah, you created two variables: x and b. You told it to print the variable named b first and x second. | 13:58 |
mulbah | did you see it Mr. Cole | 13:58 |
ubuntourist | right. I saw. | 13:59 |
mulbah | okay thanks for understanding | 13:59 |
ubuntourist | mulbah, but did you understand my "almost right"? | 13:59 |
mulbah | no | 14:00 |
ubuntourist | 101 does not mean 5 in binary. 101 binary means 5 in decimal. | 14:00 |
mulbah | oooo thanks for the correction | 14:00 |
mulbah | I understand your "almost right" now | 14:01 |
ubuntourist | I wanted it said correctly because later when we're talking about binary, octal, decimal and hexadecimal, it will be confusing if | 14:01 |
ubuntourist | I say something liike "10 binary" or 10 decimal" and you don't know which way I mean things. | 14:02 |
ubuntourist | Hold a second... | 14:02 |
ubuntourist | ok. | 14:03 |
mulbah | ACTION waiting | 14:03 |
ubuntourist | We're going to experiment with that "Ctrl-R" I talked about. We're going back to the very first "x =" | 14:04 |
ubuntourist | Type "Ctrl-R=" (without spaces) and repeat Ctrl-R until you get to the first "x =" that you typed. | 14:05 |
ubuntourist | tboimah, You've got it. Press enter. | 14:05 |
ubuntourist | ACTION waits for mulbah. | 14:05 |
tboimah | should i print x | 14:06 |
ubuntourist | Oops. Lools like he dropped out. | 14:06 |
mulbah07_ | yeah | 14:06 |
ubuntourist | No. we're going to use a different type of print. | 14:06 |
ubuntourist | mulbah07_, I want your x to be equal to the first x you typed. Use the Ctrl-R= | 14:07 |
ubuntourist | Not Ctrl-C. Ctrl-R | 14:07 |
ubuntourist | Ctrl-R= | 14:08 |
ubuntourist | (equal sign.) | 14:08 |
ubuntourist | Not C. "Ctrl-R=" | 14:08 |
ubuntourist | No. | 14:08 |
ubuntourist | = | 14:09 |
ubuntourist | And now Ctrl-R again. | 14:09 |
ubuntourist | Again | 14:09 |
mulbah07_ | wow | 14:09 |
ubuntourist | Enter | 14:09 |
ubuntourist | Good. | 14:09 |
mulbah07_ | it looks great | 14:10 |
*** mulbah has quit (Read error: Connection reset by peer) | 14:10 | |
ubuntourist | mulbah, You just did a "reverse search" through all of your "history", for all of your lines that used "=". | 14:10 |
ubuntourist | And when we found the right one, we pressed enter and it re-did the command. | 14:11 |
ubuntourist | Now, both of you: | 14:11 |
ubuntourist | print(f"{x:o}") | 14:11 |
ubuntourist | Type carefully. | 14:11 |
mulbah | okay | 14:11 |
tboimah | done | 14:12 |
ubuntourist | Great. | 14:12 |
ubuntourist | That is a special way to print values. It means we asked python to tell us the OCTAL value instead of the DECIMAL value. | 14:13 |
ubuntourist | Octal is based on powers of eight -- like octopus, and octogon. octo means eight. | 14:14 |
mulbah | so that is how to tell python to print OCTAL value | 14:14 |
mulbah | ? | 14:14 |
ubuntourist | mulbah, yes. | 14:14 |
mulbah | so what is the f means | 14:14 |
ubuntourist | So 735 OCTAL = (7 * 8**2) + (3 * 8**1) + (5 * 8**0) -- powers of eight instead of powers of ten or powers of two. | 14:15 |
ubuntourist | 111011101 binary = 735 octal = 477 decimal | 14:16 |
tboimah | okay getting the clear understanding small small | 14:16 |
ubuntourist | The same "value" or "quantity" represented three different ways. | 14:16 |
ubuntourist | tboimah, it's a difficult idea for many people. It will become clearer the more you use it but do not be too worried. | 14:17 |
tboimah | sure | 14:17 |
ubuntourist | So. FINALLY, back to "chmod" and logic... | 14:18 |
ubuntourist | and using numbers with chmod. | 14:18 |
mulbah | okay | 14:18 |
ubuntourist | chmod does other things, but most people only concentrate on the frequently used parts of the command. | 14:19 |
mulbah | but Mr. Cole you didn't explain the f is the code what it mean | 14:19 |
ubuntourist | it controls USER acccess (that's you, the owner of the file), GROUP access, and OTHER access. | 14:20 |
ubuntourist | and for each of those three, it controlls READ, WRITE and EXECUTE. | 14:20 |
ubuntourist | mulbah, I'll come back to your question later. | 14:20 |
mulbah | okay Sir | 14:20 |
ubuntourist | So, we have three types of people -- user, group and other (ugo) | 14:21 |
ubuntourist | and three types of pemissions -- read, write and exeute (rwx) | 14:22 |
ubuntourist | and each of those can be enabled, or disabled (on, or off... true or false... 1 or 0...) | 14:22 |
tboimah | + means add and - means remove | 14:23 |
tboimah | is that right | 14:24 |
ubuntourist | So... When we look at "ls -l" we see entries like "rwxrw-r--" which we can look at like... | 14:24 |
ubuntourist | rwx rw- r-- | 14:24 |
ubuntourist | 111 110 100 | 14:25 |
ubuntourist | 7 5 4 | 14:25 |
ubuntourist | (Forget about the "l" and "d" and "-" at the start. We're concerned about the permissions, not the type of entry.) | 14:26 |
ubuntourist | Do you see how those lines relate to each other? | 14:26 |
ubuntourist | (My three lines above, I mean.) | 14:27 |
mulbah | yeah | 14:27 |
tboimah | yes | 14:28 |
ubuntourist | So... Don't try it. Without looking tell me what "chmod 777" wiill do to a fiile. What will the "ls -l" show for permissions? | 14:28 |
ubuntourist | (what will "ls -l" show for permissions if you use "chmod 777" on a file?) | 14:29 |
mulbah | it will give permission to all the user group and other | 14:30 |
tboimah | chmod 777 means read, write and execute | 14:30 |
mulbah | like -rwxrwxrwx | 14:30 |
ubuntourist | Yes. Both correct. | 14:30 |
ubuntourist | So, if you remember how to use octal, it will be much easier than typing | 14:31 |
ubuntourist | chmod ugo+rwx | 14:31 |
mulbah | it's give the user group and other permission to read, write and execute | 14:32 |
ubuntourist | Especially if you get something complicated. For example if the permissions on a file are "rw-r--r--" and you want to turn ON execute for the user, and turn OFF read for everyone else, | 14:32 |
ubuntourist | the old way would be "chmod u+x,go-r" | 14:33 |
ubuntourist | The new way would be "chmod 700" | 14:33 |
tboimah | wow the old way is more simple then the new way | 14:33 |
ubuntourist | The first one says "turn on execute for user", "turn off read for group and other" | 14:34 |
mulbah | hmmm you think so tboimah | 14:34 |
tboimah | yeah mulbah | 14:34 |
tboimah | for me | 14:34 |
ubuntourist | The second one just says "turn on read, write and execcute for user" (it doesn't matter if they are already turned on), | 14:35 |
ubuntourist | turn off read, write and exccute for group (it doesn't matter if they were already off), and | 14:35 |
ubuntourist | turn off read, write and exeute for others (it doesn't matter if they were already off) | 14:36 |
mulbah | okay if you say so tboimah as for me I think the new is far way better the the old way because new thing was of doing things is easy | 14:36 |
ubuntourist | With practice, the second way is MUCH easier. Much less typiing. Harder to make mistakes. | 14:37 |
mulbah | sure | 14:37 |
ubuntourist | Now, back to your Python question, mulbah | 14:37 |
mulbah | yeah | 14:37 |
mulbah | my question was is the meaning of f in the code print(f"{x:o}") | 14:38 |
ubuntourist | Python has a syntax for formatting information. For example, when you have a number like Pi | 14:39 |
ubuntourist | 3.14159.... | 14:39 |
ubuntourist | you can tell Python to only print "3" or "3.14" or a very long "3.14159....7...2..." | 14:40 |
ubuntourist | That is "numeric formatting". You can tell it to print strings that are "left justified" or "right justified" or "centered" | 14:40 |
ubuntourist | that's string formatting. | 14:41 |
ubuntourist | But numeric formatting can also say "print this number using a different numbering system". Print a number in binary. Print a number in hexadecimal, print it in octal. | 14:42 |
ubuntourist | Let's try another example. Start up Python and set a variable to any value you want. | 14:42 |
mulbah | okay | 14:43 |
ubuntourist | You pick a variable name and a value. It doesn't matter. Well for now, stick to integers. Not Pi or something after a period. | 14:43 |
mulbah | done | 14:43 |
ubuntourist | OK. Now we'll print your variable several ways: | 14:44 |
mulbah | okay | 14:44 |
ubuntourist | The "f{.........}" means we are using a special type of string called a format string or "f-string". | 14:44 |
ubuntourist | mulbah is using "mk" and tboimah is using "x" for the variable name. I will use "kc". So where I type "kc" use YOUR variable names not mine. | 14:45 |
tboimah | okay | 14:46 |
mulbah | haha | 14:46 |
mulbah | okay Mr. Cole | 14:46 |
ubuntourist | print(f" The octal value is {kc:o}. The binary value is {kc:b}. The hex value is {kc:x} and the decimal value is {kc}.") | 14:47 |
ubuntourist | You can incude text in the f-string. So if you type it the way that I did above, it will print the words along with the values. | 14:49 |
mulbah | so Mr. Cole what | 14:50 |
tboimah | done | 14:51 |
mulbah | sorry mistake | 14:51 |
ubuntourist | f-strings are super-powerful for formatting in Python. There is a LOT more that you can do with f-strings. But that's for a Python class, not a systems administration class. | 14:51 |
mulbah | okay | 14:51 |
ubuntourist | If you want to read more about the power of f-strings and formatting, I would recommend | 14:52 |
ubuntourist | https://docs.python.org/3/ | 14:52 |
ubuntourist | (search for "mini-formatting language" I think. Or maybe "mini-format language" or "formatting mini-language"... I forget.) | 14:53 |
mulbah | okay | 14:53 |
ubuntourist | It is so complicated that I don't remember how to use all of it, and often have to go to the web and review. | 14:53 |
ubuntourist | OK. I think we've covered a lot. | 14:54 |
mulbah | sure | 14:54 |
tboimah | yeah | 14:54 |
ubuntourist | Look in the Linux Command Line book for how to use those keyboard shortcuts like TAB and Ctrl-R and a bunch of other ones. | 14:55 |
ubuntourist | They will speed up your typing a lot if you can practice them. | 14:55 |
tboimah | okay | 14:55 |
mulbah | I don't like how time just run fast like that I was really enjoying the class | 14:55 |
ubuntourist | I think it's in the section after expansions. We can come back to expansions later too. | 14:56 |
ubuntourist | mulbah, tboimah I'm glad. You both are interested, curious, smart, and willing to experiment. This will make you REALLY good at systems administration. | 14:57 |
mulbah | on my computer one shift key is giving problem that why I can take long to type sometime | 14:57 |
tboimah | okay thanks | 14:57 |
ubuntourist | (You'll probably get into trouble, and curse yourself for some stupid mistake that wipes out everything. So, we may talk about | 14:57 |
mulbah | Thanks for the motivation Mr. Cole | 14:57 |
ubuntourist | backups next. Because all good systems administraters get into deep, dangerous waters, and when we make mistakes, | 14:58 |
ubuntourist | they're often big, disasterous mistakes. | 14:58 |
mulbah | and you are the best system administration teacher I have ever seen | 14:58 |
tboimah | sure | 14:58 |
mulbah | I mean we have ever seen | 14:59 |
ubuntourist | Jeff and I have a crazy, funny friend. I call him "Hurricane" Flint. But he likes to say "What are the five most important words in the English language?" | 14:59 |
ubuntourist | "Did", "you", "back", "it", and "up" | 15:00 |
mulbah | hahahaha | 15:00 |
tboimah | hahaha | 15:00 |
ubuntourist | Well, thanks. You guys make it easy to teach. | 15:00 |
mulbah | and thanks also for the teaching | 15:01 |
tboimah | okay thank you too for making time to teach us we are very greatful | 15:01 |
tboimah | for that | 15:01 |
ubuntourist | If you spot any of the newer students that you think "Oh, this kid is smart and curious" use script and scriptreplay to teach them too. | 15:01 |
mulbah | to be real i really enjoy the teaching today | 15:01 |
ubuntourist | Jeff and I both believe that an excellent way to learn and teach is for you to try to explain what you know to someone who does not | 15:02 |
ubuntourist | yet know anything. They will ask you questions and ask you to explain something a different way because they did not | 15:03 |
ubuntourist | unddersstand your first explanation. | 15:03 |
ubuntourist | And, while "Hurricane" Flint says "Did you back it up?" is the most important thing, I think "Did you write documentation and an explanation of what you learned or did?" | 15:05 |
ubuntourist | is VERY important too. Even when I was a very young child, I forgot a lot. So, at an early age, I learned to keep very good notes. | 15:06 |
ubuntourist | And it has saved my butt a lot. When I have a disaster, I can go to my backup and my notes and recover. | 15:06 |
ubuntourist | Well, bye for today. | 15:06 |
mulbah | i will try to write down what I learned | 15:07 |
mulbah | thanks so much for today 🙃🙃🙃🙃 | 15:07 |
ubuntourist | See you Friday! | 15:07 |
tboimah | okay | 15:07 |
tboimah | have a nice day | 15:07 |
mulbah | thanks | 15:08 |
*** ubuntourist has quit (Quit: Leaving) | 15:08 | |
*** tboimah has quit (Quit: Leaving) | 15:08 | |
mulbah | exit | 15:08 |
*** mulbah has quit (Quit: Leaving) | 15:08 | |
*** mulbah has quit (Ping timeout: 480 seconds) | 16:23 |
Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!