My son’s school is offering a programming class. After my first introduction to Linux we had fun with the echo command and wrote a script that would say “Hi Fart” he was keen to learn more. He’s too young to attend the class. Instead, he has continued his journey learning Linux with me. It thought it would be hard to top “Hi Fart,” but apparently not.
I started our second lesson introducing him to the idea of the directory structure. We focused on his bedroom and tried to visualize that as /. I told him about /usr, /var, /, /etc. but that wasn’t holding his attention, I was losing him.
I decided to try something interactive. I told him about Change Directory — cd and List — ls, how they were similar and how they were different. Then, we played Linux. Starting in his room we cd-ed — changed directories — to the living room. Then we wanted to see what was in my bedroom, so we ls-ed the bedroom, peaking through the doorway without entering and listing the contents. We then ran around the house cd-ing and ls-ing the various rooms to see what was in them. It was great fun.
Next, I introduced him to some basic file manipulation commands — cat, less, and more — and we visited with our old friend echo. We again played the cd game and this time we would cat, less, and more the various objects in a room to see what was inside of them. We cd-ed into my bedroom and cat-ed the bed, dumping the contents on the floor to find pillows, sheets, and mommy, she was playing along! Then we more-ed his drawers, looking at drawers — pages — one at a time and seeing their contents. We then used less on his toy cubbies and scrolled through each cubby, back and forth, looking through his toys. I explained that you can add things to a file by using the echo command, so he decided he wanted to add a hug to the bed file for mommy.
echo “Hug” >> bed
>> adds content to a file and > replaces the content of the file so we cd-ed rooms again, this time to the bathroom, and demonstrated echo-ing to empty a file. This time the toilet was the file and emptied it via flushing:
echo “ “ > toilet
We discussed more and less and how they were different than cat and one another. I demonstrated this by using his toy shelves, which are divided into three rows of three cubbies for little drawers. To demonstrate cat we pulled all of the drawers out and saw only the last row of toys. Then for more I opened the first row of shelves only and we progressed through his toy drawers one row at a time. Then for less we did something similar, pulled open the first row, but then we also opened individual drawers as we progressed forward and backwards through the file.
I was able to turn learning Linux into a game that my son enjoys. He occasionally asks if we can play the Linux game and I of course oblige. I’m still not sure how I was able to top echo “fart,” but the Linux game is off and running. Can’t wait to see commands I can add next.