Mission Report June 28, 2020

It has been an exciting 8 weeks since the beginning of this blog initiative. I have learnt a lot of new and useful skills. I started with the “Linux and Operating System Fundamentals” course and upon its successful completion, I started the “Fullstack Development” course, which is currently ongoing and nearing completion. When I started learning about linux and operating systems, I did not have any experience or knowledge about it. To go from an empty slate to everything I now know after the completion of the course, has truly been a fun experience. As a result of all the stuff I learnt from this course, I was able to make my own trash command( I have an entire post regarding this ). The fullstack course that I have been doing for the past few weeks might be one of the best online courses in my opinion. Unlike linux, I had some basic knowledge about javascript, react and front-end development. The amount of stuff I have newly learnt as well as every other skill that I have built on is truly what I did not expect at the beginning of this course. It is entirely text based and something that I not generally used to. But the course has proved that the text based format is really resourceful if made in a certain way. This course has helped me engage and learn so many new things as I move through it. I highly recommend it to anyone who wants to get to know about modern full stack development. The blog posts have been at the crux of all my work. Learning from the course materials and sharing what I learnt at the end of the week has been the most effective learning routine I have had in a long time. I believe that everyone should engage in teaching the topics they learn. Teaching, or writing about things you have learnt is probably one of the best ways to learn a topic in depth. It not only helps you gain deeper insights about the things you are learning, but also helps anyone out there who is trying to get started. It acts a service to the community which someday is going to be repeated again by someone who you helped by your posts, who will teach it someone else and that becomes a never ending cycle of such acts which helps the learning community to remain intact and grow endlessly. I have truly enjoyed every moment of the last few weeks and I plan to just move forward from here and keep doing my best to learn and help as much as I can.

Github: https://github.com/atharvakadam
Fullstack course : https://fullstackopen.com/en

Linux and OS – How to make a new GCP instance and SSH into it .

Now let us start with the “What”, “Why”, and “How”. (I know that’s a lot of questions, but this way, it’ll be easier for us to compartmentalize sections of the title such that we understand with complete clarity about what we are trying to do here.

“What” is GCP, instance and ssh ?
  • GCP or the “Google Could Platform” is a cloud computing platform which provides a plethora of services pertaining to cloud computing. Cloud Computing is basically getting the services you desire on your computer via cloud. Now this is a very simple definition, and it by no means is everything to know about cloud computing. But Cloud computing is beast of a topic, and we will leave it for some other day. For now, all we need to understand is that GCP just like AWS, DigitalOcean and other cloud computing platforms is what we are going to use to create a linux instance. Learn more about cloud computing using GCP here.
  • An “instance” or a “cloud instance” refers to a virtual server/machine which runs our application(s)(workload) on the cloud. We will use GCP to make a linux instance which will be the linux machine that we will be using for learning linux. Learn more about “instances in cloud computing” here.
  • “SSH” also known as “Secure Shell”, is a network protocol which gives users/system admins, a secure way to access a computer over unsecured network. We will be using ssh to securely log into our GCP “instance”. Learn more about SSH here.
“WHY” GCP ?
  • In my opinion, Google Cloud Platform is really user-friendly. It is one of the best options for beginners to get started with. Since, my assumption for this article is that it is mostly going to read by beginners and first timers in cloud computing, I will be using GCP. But the main idea here is to learn how to make instances and how to ssh into it, so feel free to use whatever platform that is comfortable for you. I will be doing the AWS Cloud Certification soon, and more details about cloud computing and using AWS will be explained then. So do keep a lookout for that. For now, let us proceed with GCP.
“HOW” DO WE Make a GCP instance and ssh into it?

Okay!!! Finally we can get to some hands-on stuff. Let’s get right to it.

  • Step 1: Create and account (If you don’t have one) and log into GCP and navigate to the top left corner and click on “Console”.
  • Step 2: On the left part of the screen, in the menu, hover over “Compute Engine”, and select “VM Instances”
  • Step 3: Select a project you want to work with. If you don’t have one, then type the name of a new project and click on “Create”.
  • Step 4: Set up the billing for your account. (Don’t worry you wont be charged as you can select the free trial). So fill out the details required and finish step 1 and 2 of this billing set up.
  • Step 5: Once you start your free trial, you will be then redirected to the “VM Instances: page. It will take a few minutes to load all your settings. As soon as the loading is done, click on “Create”.
  • Step 6: Navigate to “Machine Type” in “machine Configuration” and select “f1-Micro”. The reason why we do this is because, we do not need anything fancy for learning linux. We just need the most basic configuration.
  • Step 7: Make sure that you have selected some version of “Debian” or “Ubuntu” distribution of Linux in the “Boot Disk” section. After doing this, click on “Create” button to create your instance.
  • Step 8: It will take a few minutes to set up the instance. Once its done setting up the instance , you will see the instance on your screen. You will see something like this:
  • Step 9: Open your terminal and type the following command:
    ssh-keygen -t rsa -f ~/Desktop/key_name -C user_name
    • In the above command replace “key_name” with the name you want for your ssh key. You will also replace “user_name” with the username you want for this specific ssh key. You can also replace “~/Desktop/” with whatever directory path you want to store your key in.
    • Once you execute this command, it will ask you to type a passphrase which will be a unique identifier/password for your instance. Make sure that you will remember this passphrase as it will prompt you to enter this passphrase every time you try to log in to your instance using ssh on your system.
    • This command will make two keys, one public and one private. So as soon as you execute this command, two files will be created in the specified directory.
      • The two files will be:
        • key_name.pub
        • key_name
    • So as mentioned before, the “key_name.pub” file is what contains the public ssh key which goes into your GCP instance. “key_name” remains on your machine. The public key is how the instance checks/communicates with the private key on your machine.
  • Step 10: So once you have these two files, open “key_name.pub”, and copy all the contents of the file.
  • Step 11: Open the “VM Instances” page and click on your instance name.
  • Step 12: Click on the “Edit” button, on the top.
  • Step 13: Navigate all the way down to “SSH Keys”. It will say “you have 0 SSH keys.” if this is the first time you are adding an ssh key. Clicl on “Show and Edit” and add/paste your public key that you copied in Step 10.
  • Step 14: Click on the “Save” Button at the bottom of the page. It will take a few seconds to update.
  • Step 15: Copy the external IP from the “VM Instance page.”
  • Step 15: Now open your terminal and type the following command:
    ssh -i ~/Desktop/key_name user_name@external_IP
    • If you stored your key in a different directory then remember to replace “~/Desktop” , with the path of the directory you stored your key in. Also remember to replace “key_name” with the name you saved your key. Similarly, replace user_name with the username corresponding to your instance and external_IP with what you copied in Step 15.
  • Step 16: Once you do all that correctly and execute the command, it will prompt you to type your passphrase. Type your passphrase that you saved in Step 9.
  • Step 17: Now you have successfully logged into your linux instance.

You have now ready to dive right into Linux. Hopefully this article was useful. I will post some other useful articles and links regarding GCP and SSH soon. Will see you in our next post, as we dive straight into “Introduction of Operating Systems.”

The Trash Command

Almost every beginner in linux/unix systems at some point in time has messed up because of the infamous rm command. For those who don’t know, the rm -rf command is user to delete any given directory/file. Now while it doesn’t sound all that bad, it is really unforgiving and could really mess things up for someone who doesn’t know what they are doing. As I mentioned in my previous post, I worked on a linux and operating system fundamentals course this week. I learnt a lot of new things starting from what is the job of an operating system to learning shell scripts to execute command and automate stuff as a system admin. I found shell scripts to be really interesting, and that motivated me to work on this trash command idea. The motivation behind this was to figure out a way to make a command that is more forgiving than the rm command. So I came up with a suite of trash commands.

This suite includes the following commands:
> trash-add : This command adds the given file to the trash can directory
> trash-remove : This command removes the given file from the trash can and the system permanently
> trash-restore : This command restores the given file in the specified directory .
> trash-empty : This command empties the trash can and removes all the contents of the trash can permanently from the trash can and from the system.
> trash-show : This command shows all the contents of the trash can in a neat formatted way.

  • The trash-add command :
    This command is the core of all the functionalities of the trash can. The idea behind this function was a really simple one. If the user doesn’t have a trash can then make one, or
    else add the requested file/directory to the existing trash can.

The above code snippet shows the trash-add command’s shell script. The code for all these commands along with the documentation and instructions to set up can all be found on my
Github Repo : https://github.com/atharvakadam/Trash-Suite-Linux

This was my first project and experience with shell scripts and I am very happy with this effort. I plan to make this better by adding on to the functionalities, and making it better. I hope this helps everyone who is interested and looking to start out with shell scripts.

Linux and Operating Systems Fundamentals

Learning to work with linux is one of the few extremely essential skills that every programmer should be equipped their skillset with. I recently began working on a course focused towards linux and other unix based operating systems. I believe that this course has some very interesting insights and I plan to note all of them down as I proceed with the course. While doing so, I will also share them here every week, so that these insights could help every beginner out there, trying to figure out where and how to start.