It's already a week. Our first objective is to learn Unix. I think I never heard that word before this adventure. As I find myself very new to all these things, I find it very interesting too.
So first i have to install Linux into my laptop. Linux closely resembles Unix they say! I chose Ubuntu. The whole process of installing Ubuntu was quite easier than Windows. But dual booting, 2GB ram and limited space in SSD gave a headache.
As course started, we got kit of very useful references. It was kind of rewarding experience! I wouldn't have bought this many books for myself. Thanks Noufal Ibrahim for that. To study Unix we have "The Unix Programming Environment" By Brain W.Kernighan and Rob Pike (Both are members of Unix teams while it was developing at Bell lab). Even though this book quite old, it's still good. Plus it's giving a depth to the history of Unix with the old ways! Only finished first chapter as of now, miles to go...
How to always win Hangman (CHEAT):
Hangman is an interesting word-guessing game and games are interesting way to learn. This game is available in the shell and you can use the same shell to cheat the game. The cheat is utilizing two important facilities of the shell. Filename short hands and Input-output redirection. This lesson taught by Noufal Ibrahim was quite brilliant. Now I always gonna win in Hangman.
Filename short hands: you can pick up a whole set of filenames by specifying a pattern for the names. But here we are using much more complex patterns and some of the arguments will be just for grep.
Input-output redirection: Input and output can be connected to other programs. This is the idea behind pipe; a pipeline is a connection of two or more programs through pipes.
The main program for the cheat is 'grep' it finds words that matching pattern. It will explained as if you know how to play hangman. If you don't you should definitely try it. Let explain it with an example:
It was a 7 letter word. First I tried with vowels, 'aeiou' and found word structure to be 'a___ai_' (The blanks will not be 'aeiou')
grep ^a[^aeiou][^aeiou][^aeiou]ai[^aeiou]$ $words | grep '.......'|wc -l
This gives 3 possibilities : abstain, acclaim, archaic
First program will find all the words from dictionary ($words*) that follows the format 'a___ai_'. The output piped to filter all other words except 7 letters. 'wc -l' counts all the words that reach end of the pipeline.
$words represents dictionary in the computer. The path to dictionary is saved in words, words=/usr/share/dict/words. This kind of personalization is facility provide by shell.
With few more guesses, word found to be 'Archaic'. This example is maybe the easiest one, but I couldn't have done it without the cheat. There is still a lot of room for improvement in this cheat. We can improve as we learn more.
As this exercise covers lot of basics of shell, I find it very useful. It's really a good way to get started in Unix.
We got introduced about SSH (Secure shell) and made accounts in Lycaeum server. Apart from checking 'who' else is logged into the server, I don't know anything to do with it. But I am sure it will be of great use in the near future.
Typing is very important computer skill. If you are pro, you would be save a lot of time. INARGUABLE. But gtypist kind of frustrating. Lots of errorrrrr. We are marking our wpm(words per minute) in the given 'daily activity chart'. Hoping to see a scalable improvement soon.
Thank you for reading my blog.