<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Devanshu Tiwari on Medium]]></title>
        <description><![CDATA[Stories by Devanshu Tiwari on Medium]]></description>
        <link>https://medium.com/@dev-spectre91?source=rss-4ee8d35fa84c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KlO4EEcX_l9j-M097eEN8A.jpeg</url>
            <title>Stories by Devanshu Tiwari on Medium</title>
            <link>https://medium.com/@dev-spectre91?source=rss-4ee8d35fa84c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 01:15:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dev-spectre91/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Set Up SSH Authentication for GitHub on macOS (Step-by-Step Guide)]]></title>
            <link>https://dev-spectre91.medium.com/how-to-set-up-ssh-authentication-for-github-on-macos-step-by-step-guide-a41b03f63239?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a41b03f63239</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Sat, 21 Nov 2026 13:25:02 GMT</pubDate>
            <atom:updated>2026-11-21T13:34:12.349Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m3tq4piOnCY4Nb0aB7Uwyg.png" /></figure><p>If you have recently started using Git and GitHub on your Mac, one of the first things you should do is configure SSH authentication.</p><p>SSH allows you to connect your local machine to GitHub securely without entering your username and password every time you push or pull code.</p><p>In this article, we’ll configure SSH authentication on macOS from scratch and understand what each command actually does.</p><p>You don’t need to be an expert in Git or Linux to follow this guide.</p><h3>Step 1: Configure Your Git Username</h3><p>Open your Mac Terminal and execute:</p><pre>git config --global user.name &quot;DT&quot;</pre><p><strong>What does this command do?</strong></p><p>Git needs to know who is making changes to the code.</p><p>This command sets your global Git username. Whenever you create a commit, Git uses this name to identify the author.</p><p>The --global flag means this configuration applies to all Git repositories on your Mac, unless a repository has its own local configuration.</p><h3>Step 2: Configure Your Git Email</h3><p>Execute:</p><pre>git config --global user.email &quot;dt@email.com&quot;</pre><p><strong>What does this command do?</strong></p><p>This sets the email address associated with your Git commits.</p><p>Ideally, use the email address associated with your GitHub account so your commits can be correctly associated with your GitHub profile.</p><h3>Step 3: Verify Your Git Configuration</h3><p>Execute:</p><pre>git config --global --list</pre><p><strong>What does this command do?</strong></p><p>This displays all your global Git configurations.</p><p>You should see something similar to:</p><pre>user.name=DT<br>user.email=dt@email.com</pre><p>This confirms that your Git username and email have been configured.</p><h3>Step 4: Create the SSH Directory</h3><p>Execute:</p><pre>mkdir -p ~/.ssh</pre><p><strong>What does this command do?</strong></p><p>SSH keys and configuration files are stored inside a hidden directory called .ssh in your home directory.</p><ul><li>mkdir creates a directory.</li><li>-p creates the directory if it doesn&#39;t exist and avoids an error if it already exists.</li><li>~ represents your home directory.</li></ul><p>Now, set the correct permissions:</p><pre>chmod 700 ~/.ssh</pre><p><strong>What does this command do?</strong></p><p>It restricts access to your SSH directory.</p><ul><li>7 means the owner has read, write and execute permissions.</li><li>0 means group members have no permissions.</li><li>0 means other users have no permissions.</li></ul><p>This ensures that only your user account can access the directory.</p><h3>Step 5: Generate an SSH Key Pair</h3><p>Execute:</p><pre>ssh-keygen -t ed25519 -C &quot;dt@email.com&quot; -f &quot;$HOME/.ssh/id_ed25519_github&quot;</pre><p><strong>What does this command do?</strong></p><p>This generates two SSH keys: a private key and a public key.</p><p>Let’s understand each part:</p><ul><li>ssh-keygen: Utility used to generate SSH keys.</li><li>-t ed25519: Specifies the Ed25519 algorithm, a modern and secure SSH key algorithm.</li><li>-C: Adds a comment to identify the key, usually your email address.</li><li>-f: Specifies where the generated key files should be saved.</li><li>$HOME: Represents your home directory.</li></ul><p>We are explicitly naming our key id_ed25519_github.</p><p><strong>Why use </strong><strong>$HOME instead of </strong><strong>~?</strong></p><p>When you enter a filename in the interactive SSH key generation prompt, shell expansion does not happen. This means ~ and $HOME may be treated as literal characters.</p><p>Using $HOME in the actual terminal command works because the shell expands it before executing ssh-keygen.</p><p>You will now be asked to enter a passphrase.</p><p>You can either create a passphrase for additional protection or press Enter twice to continue without one.</p><p>After successful generation, two files will be created:</p><pre>id_ed25519_github       → Private key<br>id_ed25519_github.pub   → Public key</pre><p><strong>Important:</strong> Never share your private key with anyone.</p><h3>Step 6: Start the SSH Agent</h3><p>Execute:</p><pre>eval &quot;$(ssh-agent -s)&quot;</pre><p><strong>What does this command do?</strong></p><p>The SSH agent is a background process that manages your private SSH keys.</p><p>Instead of repeatedly providing your private key passphrase, the agent can hold the unlocked key in memory and use it when authentication is required.</p><p>The command starts the SSH agent and configures your current terminal session to communicate with it.</p><h3>Step 7: Add Your SSH Private Key to the Agent</h3><p>Execute:</p><pre>ssh-add ~/.ssh/id_ed25519_github</pre><p><strong>What does this command do?</strong></p><p>This adds your private SSH key to the SSH agent.</p><p>If you created a passphrase while generating your key, you may be asked to enter it.</p><p>Once added, the SSH agent can use this key when connecting to GitHub.</p><h3>Step 8: Verify the SSH Key Is Loaded</h3><p>Execute:</p><pre>ssh-add -l</pre><p><strong>What does this command do?</strong></p><p>This lists the identities (SSH keys) currently loaded in your SSH agent.</p><p>If everything is configured correctly, you should see your Ed25519 key listed.</p><h3>Step 9: Configure SSH for GitHub</h3><p>Now, we need to tell SSH which private key it should use when connecting to GitHub.</p><p>Execute:</p><pre>nano ~/.ssh/config</pre><p><strong>What does this command do?</strong></p><p>This opens the SSH configuration file using the Nano text editor.</p><p>If the file doesn’t exist, Nano will create it when you save.</p><p>Add the following configuration:</p><pre>Host github.com<br>    HostName github.com<br>    User git<br>    IdentityFile ~/.ssh/id_ed25519_github<br>    IdentitiesOnly yes</pre><p>Let’s understand these settings:</p><ul><li>Host github.com: Defines a configuration rule for connections to GitHub.</li><li>HostName github.com: Specifies the actual server address.</li><li>User git: GitHub SSH connections use the git username.</li><li>IdentityFile: Specifies which private SSH key should be used.</li><li>IdentitiesOnly yes: Tells SSH to use the specified identity rather than trying other available identities.</li></ul><p><strong>How to save the file in Nano:</strong></p><ol><li>Press Control + O to save.</li><li>Press Enter to confirm the filename.</li><li>Press Control + X to exit.</li></ol><h3>Step 10: Set Permissions for the SSH Configuration File</h3><p>Execute:</p><pre>chmod 600 ~/.ssh/config</pre><p><strong>What does this command do?</strong></p><p>This restricts access to your SSH configuration file.</p><ul><li>6 means the owner can read and write.</li><li>0 means group members cannot access it.</li><li>0 means other users cannot access it.</li></ul><p>SSH uses strict permission checks to protect sensitive configuration and key files.</p><h3>Step 11: Copy Your Public SSH Key</h3><p>Execute:</p><pre>cat ~/.ssh/id_ed25519_github.pub</pre><p><strong>What does this command do?</strong></p><p>The cat command displays the contents of a file in your terminal.</p><p>Here, it displays your public SSH key.</p><p>Copy the entire output. It should start with something similar to:</p><pre>ssh-ed25519 AAAAC3NzaC1lZDI1NTE5...</pre><p>Make sure you copy the complete public key, including the ssh-ed25519 prefix.</p><h3>Step 12: Add Your Public Key to GitHub</h3><p>Now that we have generated our SSH key pair, we need to register the public key with GitHub.</p><p>Follow these steps:</p><ol><li>Open GitHub.</li><li>Click your profile picture.</li><li>Go to Settings.</li><li>Select SSH and GPG keys.</li><li>Click New SSH Key.</li><li>Give your key a suitable title, such as My MacBook.</li><li>Select Authentication Key as the key type.</li><li>Paste the public key you copied in the previous step.</li><li>Click Add SSH Key.</li></ol><p>You can access the page directly here:</p><p><a href="https://github.com/settings/ssh/new">https://github.com/settings/ssh/new</a></p><p><strong>Remember:</strong> Upload only the .pub file contents. Never upload or share your private key.</p><h3>Step 13: Test Your SSH Connection</h3><p>We have completed the configuration. Now let’s verify whether our Mac can successfully authenticate with GitHub.</p><p>Execute:</p><pre>ssh -T git@github.com</pre><p><strong>What does this command do?</strong></p><ul><li>ssh: Starts an SSH connection.</li><li>-T: Prevents allocating an interactive terminal.</li><li>git@github.com: Connects to GitHub using the Git SSH user.</li></ul><p>The first time you connect, you might see a message asking whether you trust the GitHub host.</p><p>Type:</p><pre>yes</pre><p>If everything is configured correctly, you should receive a message similar to:</p><pre>Hi DT! You&#39;ve successfully authenticated,<br>but GitHub does not provide shell access.</pre><p>This is not an error. It means your SSH authentication was successful.</p><p>Congratulations! Your Mac is now configured to authenticate with GitHub using SSH.</p><h3>Final Thoughts</h3><p>Setting up SSH authentication might seem complicated when you do it for the first time, but once you understand what each command does, the process becomes straightforward.</p><p>The main things to remember are:</p><ul><li>Git configuration identifies the author of your commits.</li><li>SSH key generation creates a private and public key pair.</li><li>The SSH agent manages your loaded private keys.</li><li>The SSH configuration file tells your Mac which key to use for GitHub.</li><li>Adding your public key to GitHub establishes the trust relationship.</li><li>The final SSH test confirms that everything works.</li></ul><p>You can now clone, push and pull GitHub repositories using SSH without having to authenticate with your GitHub password every time.</p><p>Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a41b03f63239" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick start guide to Node.Js: Part-4]]></title>
            <link>https://dev-spectre91.medium.com/quick-start-guide-to-node-js-part-4-4625fdae817e?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4625fdae817e</guid>
            <category><![CDATA[packagejson]]></category>
            <category><![CDATA[package-lock]]></category>
            <category><![CDATA[core-node-modules]]></category>
            <category><![CDATA[npm-package]]></category>
            <category><![CDATA[node-js-tutorial]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Fri, 03 Sep 2021 08:19:44 GMT</pubDate>
            <atom:updated>2021-09-03T08:51:11.147Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*JbwUY90h1uvV7jE0NtZjbw.png" /></figure><h3>Working with modules in NodeJs</h3><p>So far, we have seen that Node provides us with some <strong>Global modules</strong> and some<strong> Pseudo Global modules</strong>, and we can use modules written by others by installing packages from npm store. <br>What this means is we can utilise module system in three ways:<br>1. Use Global Modules in our Project directly.<br>2. Use core node modules- using <strong>require(‘&lt;module-name&gt;’).</strong><br>3. Use our own modules within project- using <strong>require(‘&lt;module-name&gt;’)</strong> and <strong>module.exports</strong><br>4. Use module from npm store - running <strong>npm install &lt;package-name&gt;</strong> and then requiring it using <strong>require(‘&lt;package-name&gt;’)</strong></p><p>If you are new to NodeJs, the 3rd way might need some clarity.<br>When we are working on a project, it can happen that we require a part of code from one module inside another. To do this, <strong>we need to first expose the desired code</strong> from that module using <strong>module.exports</strong>(which is a global ) and then require it, where it is needed by specifying the path of the file from where it was exported from.<br>The module is a variable that represents the current module, and exports is an object that will be exposed as a module. So, whatever you assign to module.exports will be exposed as a module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*cWhZTJJrubuQpqiiW1xeVg.jpeg" /><figcaption>using module.exports to expose add function from utils.js</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0pTHOaAljyS3p02fQ0QLtg.jpeg" /><figcaption>uusing the add function from utils.js in start.js</figcaption></figure><h3>What is the utility of a package .json file?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x4tww7wRbu1l6ZSdci8Efg.jpeg" /></figure><p>A <strong>package.json</strong> file is a human readable meta-data about your project in JSON format located at the root of project. It contains important details like,<strong> author, name , version, description, scripts, engines and dependencies</strong> if any. <br><strong>When is it created?</strong><br>We will mostly need a package.json file before we can use any other package from npm. However, even if we are not using external packages it is wise to create a package.json file, as it will help us to manage versions and also allow us to publish our package to npm in future. <br><strong>How to create it?<br></strong>We can use the command npm init or<strong> npm init -y</strong> , to create package.json file. If we use npm init , it will ask for few details about our project, but if we want to fast forward to a auto-filled package file we can use <strong>npm init -y</strong>. <br>Now, whenever we install a package, it will get added to package.json file as dependencies and a <strong>npm_modules</strong> folder will get created.<br><strong>Utility of this file?<br></strong>As this has already been mentioned, this file contains meta-data related to our project in json format. It sets the entry point to our project using main key. We can make our package private using private key. Using scripts , dependencies , devDependencies we can set scripts to run, define package dependencies, and developement dependencies respectively. The version key requires a more in depth explaination, so we will cover it in a later article (<strong>Semantic versioning in Node.Js</strong>). For now, let’s talk about the most common benefit of a package.json file.</p><p>In projects, it is a good practice to use<strong> .gitignore</strong> file to ignore npm_modules before pushing our code to remote repository. It is because npm_modules folder has a big size, and copying it takes a lot of time and unnecessary space in remote. So , these files are ignored and not uploaded. Now, if we clone a project and it does not have npm_modules that it needs to run, we are going to face errors and the project won’t run. Why? Because it is not able to find the required packages in node_modules.<br>This is where package.json file comes to our rescue. As it already has a list of dependencies, we just have to run <strong>npm install</strong>. And it will download the required packages automatically using the contents from <strong>package.json and package-lock.json</strong>. (the lock file is used to ensure the integrity and sanity of the installed modules)<br><strong>A note about package-lock.json from Node Docs: </strong><br> “<em>The goal of </em><em>package-lock.json file is to keep track of the exact version of every package that is installed so that a product is 100% reproducible in the same way even if packages are updated by their maintainers.”</em></p><p>In the next article, we will start with two important core node modules: the <strong>file system module</strong> and the <strong>http module</strong>. Hope to see you there!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4625fdae817e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick start guide to Node.Js: Part-3]]></title>
            <link>https://dev-spectre91.medium.com/quick-start-guide-to-node-js-part-3-924b8f70e70?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/924b8f70e70</guid>
            <category><![CDATA[node-js-tutorial]]></category>
            <category><![CDATA[node-globals]]></category>
            <category><![CDATA[buffer]]></category>
            <category><![CDATA[repl]]></category>
            <category><![CDATA[script-processor]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Tue, 31 Aug 2021 18:42:05 GMT</pubDate>
            <atom:updated>2021-09-03T08:20:39.988Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*D0_KqXwsdSqv3mk74g9BSA.jpeg" /></figure><h3>Script Processor Mode and REPL mode in Node.Js</h3><p>As can be seen from the above image, we can execute a script using the script processor mode of Node.Js. We need to be in the directory where our script is present. Then executing the command <strong><em>node &lt;script-name&gt;</em></strong> will run our script and we will see the output in the console. Here an event loop is initialised in background which manages the execution of the asynchronous code of our script.<br><strong>The second mode of Node.Js is the REPL</strong> : Read, Evaluate, Print, Loop. Its very similar to the console we get in browser to execute browser Api’s and javascript. Here in REPL mode we can run all Api functions provided by node environment along with our Javascript Code. <br><strong>Read</strong>: Because it expects us to enter code expression and then parses it: (2+2)<br><strong>Evaluate</strong>: Evaluates our expression<br><strong>Print</strong>: Prints the Result to console<br><strong>Loop</strong>: Ready again to take some input expression.</p><p>Now, lets get started with the <strong>Buffer</strong> class which is a global in Node.js, which means that we don’t need to require it.</p><h3>Buffer in Node.js</h3><p>In Node, we can interact with the file system using the<strong> fs module</strong>, make network requests using the<strong> http module</strong>. The files that we deal with in our digital machines stores data in<strong> binary form 1’s and 0’s</strong>. These files are not loaded at once in memory, infact that is exactly <strong>why Buffer class in needed! </strong><br>Because Javascript do not have a byte type, so extra work needs to be done to interact with this binary data. <br>The data coming in streams, needs to be stored at some temporary place (also known as a buffer), which usually happens when the speed of data processing is greater than the speed of download. We all have experienced this at some point in our lives when we watch some live streaming video, it can buffer.<br>It is the <strong>Buffer class that provides methods in Node to deal with binary streams of data.</strong> To achieve this, we have various methods in Buffer class.<br>Some important functions in Buffer Class:<br><strong>Buffer.alloc(</strong>10)- This will allocate 10 bytes of space in RAM.<br><strong>Buffer.allocUnsafe(10)</strong>: Similar to alloc( ), but can contain random binary data that needs to be overwritten<br><strong>Buffer.from</strong>(‘Hello from dev!’)</p><p><strong>toJSON( )</strong>- Converts buffer data to a Json Object.<br><strong>toString( )</strong>- converts buffer data to a string using utf-8 encoding by default.</p><h3>Why do we need to know about Buffer class?</h3><p>Because when we start working on file-system module and http module, it is the Buffer class, which handles all the interactions in these modules, to interact with streams of binary data. For a proper understanding and appreciation of how Node.Js handles stream of data, this introduction was indeed necessary. 😃</p><p>Now, that we have covered the basic Buffer module, we can start with File system module and http module! But even before that, in the next article, lets understand how to use external Node modules and the package.json file. Here’s the link to it: <a href="http://Quick start guide to Node.Js: Part-3"><strong>Quick start guide to Node.Js: Part-4</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=924b8f70e70" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick start guide to Node.Js: Part-2]]></title>
            <link>https://dev-spectre91.medium.com/quick-start-guide-to-node-js-part-2-4151986d1cba?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4151986d1cba</guid>
            <category><![CDATA[node-js-tutorial]]></category>
            <category><![CDATA[ryan-dahl]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[educative]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Tue, 31 Aug 2021 12:42:24 GMT</pubDate>
            <atom:updated>2021-08-31T19:07:26.504Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*WBKCj616TYebXe8_A_atUA.jpeg" /></figure><p>Now that we have succesfully installed node on our system. We can check which version got installed by running the command <strong>node - - version.<br></strong>With<strong> </strong>node,<strong> npm (node package manager)</strong> automatically got installed for us. <br>NPM is like a store where you can shop for <strong>open source libraries</strong> written by other developers to make your life easier. We will see how we can benefit from the code written by others.<br>Before going further, it is worth mentioning that Node.Js documentation can be found at <a href="https://nodejs.dev/learn/"><strong>Node Docs</strong></a><strong><br></strong>Also, We won’t have access to<strong> browser specific API’s like DOM, cookie</strong> etc. which obviously is not needed because, we are now working outside the browser environment. However, we do now have access to the <strong>filesystem, os, network, process</strong> through modules provided by Node.Js environment.</p><h3>Module System of Node.js</h3><p>What is a module?<br>A <strong>Module(library)</strong> is a small, independent reusable unit of code. Whatever code we write in a module exists as an independent entity. It can be used in other parts of your application. The developer uses this pattern to define private and public members in the code.</p><p>Node.Js uses the CommonJs module system to support modularity in development. <strong>Every javascript file is a module in itself</strong>. To get functionality from other modules we need to require them using <strong>require( )</strong> method. In contrast, to get modularity in <strong>browser-side we need to use import statement from ES6.</strong></p><h3>Global and Core Node modules</h3><p>In Node.Js we have some <strong>global modules</strong> that we don’t need to require. E.g. <br>console, timer, require, process. They are available by default everywhere in your project and can be used directly. In contrast, if we want to use a core node module, we have to require it using the require( ) method. E.g. fs module, os module etc.</p><p>Some globals are true globals while others are <strong>pseudo global</strong>. The global object, console, process are all <strong>true globals</strong>. We don’t need to be in a module to access them. But to access Pseudo globals we need to be in a module. For. E.g. <strong>__filename, __dirname, module.exports, require( )</strong>.</p><h3>What is the difference between a package and a module then?</h3><p>A package is a collection of modules. Typically a package will have one or more javascript files(module) inside it. For.e.g. Animal package might have Aquatic.js, Terrestial.js modules inside it. Node.js use a package manager (npm) using which we can access package wriiten by others and use them in our project. What does this mean? It means, we don’t need to write everything from scratch. Say, your project needs a lot of Array manipulation and requires utility functions related to Arrays. We can just install the <strong>lodash package</strong> in our project, and use its utility functions to manipulate Arrays . This saves a lot of time and also helps in <strong>writing cleaner code</strong>.</p><p>Remember, packages can be installed globally or locally. A globally installed package will be same for all your applications/projects. It can be installed using <strong>npm install -g &lt;package-name&gt; </strong>. It gets installed in your systems bin directory unlike the packages that are installed locally, which are stored under node_modules directory in the working directory. <br>A package <strong>should be installed globally</strong> when it provides an executable command that you run from the shell (CLI), and when it is reused across projects.<br>Normally we will use the<strong> npx</strong> command to run an executable package (like <strong>create-react-app</strong>) to avoid installing it globally. This is useful when we need to try a package before installing it globally or locally.</p><p><strong>That being said, in most cases we would want to install packages locally</strong>. As different parts of our projects might require different versions of a package. Installing it globally will cause an package update make changes everywhere.</p><p>To see what packages are installed globally on our system we can run the command : <strong>npm list -g — depth 0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*-1ZhkSBnFYAfAV15hwlv4A.jpeg" /></figure><p>In the next Article, i will explain some<strong> Core Node Modules</strong> and their practical use in backend app developement.<br>Link to next article: <a href="https://dev-spectre91.medium.com/quick-start-guide-to-node-js-part-3-924b8f70e70"><strong>Quick start guide to Node.Js:Part-3</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4151986d1cba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick start guide to Node.Js: Part-1]]></title>
            <link>https://dev-spectre91.medium.com/quick-start-guide-to-node-js-part-1-c456c5fb0c74?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c456c5fb0c74</guid>
            <category><![CDATA[node-js-tutorial]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[asynchronous]]></category>
            <category><![CDATA[v8-engine]]></category>
            <category><![CDATA[ryan-dahl]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Mon, 30 Aug 2021 19:27:00 GMT</pubDate>
            <atom:updated>2021-08-31T19:15:28.239Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K06P7WUB_8qks0T3WIRAww.jpeg" /></figure><h3>What is Node.Js?</h3><p>It’s a<strong> runtime Environment</strong> for Javascript which lets you run Javascript code outside the browser environment.<br>But, when we already have options like asp.net, django, rails etc, why do we need NodeJs?</p><p>Let’s find out why…</p><h3>Why Node.Js?</h3><ol><li><strong>Easy</strong> to learn</li><li>Superfast and <strong>highly scalable</strong></li><li>Less code, <strong>Javascript everywhere </strong>(A frontend JavaScript developer can easily learn Backend, in less time)</li><li>It has<strong> npm</strong>, a large ecosystem of open source libraries.</li></ol><h3>How does it work?</h3><p>Every browser has a Javascript engine that converts Javascript to machine code. E.g.<strong> V8 -Chrome, Chakra-Internet Ecplorer, FireFox- SpiderMonkey</strong>. That is why sometimes Js code may behave differently in different browsers. What this means is that we can only execute Javascript code inside our Browsers. This was the reality until in 2009, <strong>Ryan Dahl</strong> came up with an excellent idea to take out Javascript outside the browser. So he embedded <strong>Chrome’s V8 engine</strong> inside a C++ program and called it Node.Js. This gave Javascript capability to use various objects that earlier were not allowed by browsers due to security issues. With Node.js, <strong>we can access file system of a machine, OS module, path module, http module</strong> etc.</p><h3>Where is it being Used?</h3><p>Big organisations like <strong>NASA, PayPal, Netflix, Uber, Trello, Medium, eBay</strong> etc to name a few are all using Node.Js to build fast, scalable and robust products.</p><h3>Is it Non-blocking and Asynchronous?</h3><p>Imagine you are in a Pizza shop, standing in a queue to order your favourite variant. But wait, in this Pizza shop, they have a peculiar synchronous order policy! The guy at the counter will take your Pizza-order only when the customer before you gets his Pizza, finishes it and leaves the shop. All that time in between he is sitting idle, maybe watcing some random tiktok videos! <br>Getting tired of complaints the manager decides to hire new counter guys. But the Policy is still the same- <strong><em>“take new order only when previous customer has finished eating and left the shop!”</em></strong>. Anyways, they still offfer delicious pizzas so they start receiving huge volumes of customers and as you might have guessed they have to wait and wait! Now if the Pizza shop is our application and the counter guy the thread of execution. Our application will need more threads to serve new requests, which means the cost of resources will go up. This is quite the case with <strong>synchronous-blocking code</strong>.</p><p>Normally, when you go to a Pizza shop, after placing the order, they give you a token, and you immediately move out of queue so that the guy after you can place his order. So, even when our counter guy can handle one order at a time, he is not going to sit idle in between taking order and its fulfilment. There’s a buzzer(event-loop in case of Node.Js) which signals the counter guy that the previous order is ready to be delivered. This is how <strong>asynchronous -non-blocking code </strong>works. <br><strong>So the answer to the above question is, yes!</strong></p><p><strong>Node.Js is a non-blocking and asynchronous runtime environment</strong>. <strong>It uses full advantage of V8 and event-loop to run things asynchronously making it blazing fast and highly scalable</strong>.</p><p>This makes it great choice for building I/O intensive applications that require a lot of disk /network access.</p><h3>What next?</h3><p>Lets start working with node. To start we need to have Node.Js installed on our system. Go to<strong> </strong><a href="https://nodejs.org/en/"><strong>https://nodejs.org/en/</strong></a> and install the latest release (LTS). <br>In next Article, we will see some interesting modules in Node.Js<br>Link to the next Article: <a href="https://dev-spectre91.medium.com/quick-start-guide-to-node-js-part-2-4151986d1cba"><strong>Quick start guide to Node.js: Part-2</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c456c5fb0c74" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why customer feedback can make or break your business?]]></title>
            <link>https://dev-spectre91.medium.com/why-customer-feedback-can-make-or-break-your-business-7bf8a1c5a71?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bf8a1c5a71</guid>
            <category><![CDATA[customer-feedback]]></category>
            <category><![CDATA[customer-feedback-tools]]></category>
            <category><![CDATA[feedback]]></category>
            <category><![CDATA[customer-experience]]></category>
            <category><![CDATA[feedback-management]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Wed, 20 Jan 2021 19:34:47 GMT</pubDate>
            <atom:updated>2021-01-22T06:56:47.527Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why customer feedback can make or break your business ❓</h3><p>The famous management guru <a href="https://en.wikipedia.org/wiki/Peter_Drucker"><strong>Peter Drucker</strong></a> gave a simple definition of what exactly a Business means. He said : “Business is <strong>Serving your Customers, profitably!</strong>”. <br>Businesses are all about “Customers”. So, every business out there is getting success by either providing a solution to some already existing problem or by fixing a loophole in a well established system. Here, the customer is the primary entity that defines the problem. And feedback is the basis for improving on the solution, such that your customer stays with you, even when multiple solutions exists out there.</p><p>The critics of Customer Feedback often quote <strong>Henry Ford 🚗</strong>, who famously said: “<strong><em>If I had asked people what they wanted, they would have said a faster horse.</em></strong>” This was even quoted by <strong>Steve Jobs</strong> in one of his interview with Forbes. But technology giants like Apple also rely on customer experience and feedback management. Although, they may not go to their customers directly to get opinion, they do use “<a href="https://www.techopedia.com/definition/30784/dogfooding"><strong>dogfooding</strong></a>” technique (getting the employees to test a new feature, before rolling it out to the public). And when the customer feedback process is skipped , even Apple runs into problems, like the one they faced when they changed the position of the Power Button in Mac Book Pro 2013. This decision got huge negative comments from customers despite it being an improvement over the earlier version. All this, because the decision was taken inside-out without taking in customer’s opinion.</p><p>While it’s true that customers cannot possibly think of a break-through product or help you to invent the next-generation technology, but that doesn’t mean that getting their feedback or opinion is a waste of time. Why you ask? <strong>Read on… 💬</strong></p><h3>The 5 most important benefits of getting Customer feedback:</h3><p>1. It helps you to <strong>get unbiased opinion</strong> about your service/product. It can be negative or positive, prompted or unprompted. While negative feedbacks signifies new challenges ahead, but they also provides opportunity to bring in new customers. The positive ones will motivate and inspire you to work even harder.</p><p>2. Customers will realize that you consider them important and that their opinion matters. This brings a <strong>sense of ownership</strong> in them, that will definitely <strong>create a lasting bond between your product and the customer</strong>.</p><p>3. The feedback<strong> can be used in analytics to take future business decisions </strong>which will save a lot of money and man-hours.</p><p>4. Feedback <strong>brings a scope of innovation w</strong>ith them as the product team <strong>may find valuable insights regarding a loophole</strong> in existing solution.</p><p>5. It results in Customer-satisfaction when the voice of customer is heard and addressed effectively. A <strong>satisfied customer remains loyal to a brand</strong>. And the marketing that is achieved by word-of-mouth, is extraordinarily effective. So a satisfied<strong> customer is likely to become your brand-ambassador</strong> which will definitely <strong>bring new loyal customers.</strong></p><p>Finally, let’s quote <strong>Steve Jobs</strong> one more time, but this time, him being in support of Customer Feedback. He said this in <strong>Apple’s 1997 Worldwide Developers Conference</strong> :<br><em>“You’ve got to start with the customer experience and work backwards to the technology. You can’t start with the technology and try to figure out where you’re going to try to sell it. . . . As we have tried to come up with a strategy and a vision for Apple, it started with: What incredible benefits can we give to the customer? … Not starting with: Let’s sit down with the engineers and figure out what awesome technology we have and then how we’re going to market that. And I think that’s the right path to take</em><strong><em>.</em></strong><em>”</em></p><p>Hence, Customer Feedback has the ability to turn your business upside-down. Using it to your advantage will not only help your business to survive and stay relevant, it can help you to create innovative solutions that may change the world 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bf8a1c5a71" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Project Management in WSL: How to use wsl for development?]]></title>
            <link>https://dev-spectre91.medium.com/project-management-in-wsl-how-to-use-wsl-for-development-45715667343a?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/45715667343a</guid>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Tue, 19 Jan 2021 20:56:19 GMT</pubDate>
            <atom:updated>2021-01-20T07:02:24.645Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*ndUfPfkGTKDDMOqydSFLMA.jpeg" /></figure><p>If you have decided to use WSL in Windows for your development work, you will most probably face one common dilemma. <strong>Should you save your project files in Windows file system</strong> which is NTFS or <strong>should you use the ext file-system of Linux</strong>? The answer is short and interesting. 😛</p><blockquote><strong>WSL — According to Microsoft :</strong><br>The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, <strong>without the overhead of a traditional virtual machine or dualboot setup</strong>.</blockquote><p><strong>Method 1: Using Linux file system to access files on Windows:<br></strong>Let’s say you decide to store all your projects in C drive. For doing that using terminal, you have to change directories to reach C drive using <strong>cd</strong> command. As the windows file system is mounted in the /mnt folder in WSL. From here, we can access C drive by changing directory /mnt/c/ . Now creating a projects folder using mkdir here will result in a projects folder being created in our Windows C drive. We can create a symlink to our projects folder that we just created. So, everytime we create a new project we only have to change directory to the symlink that we created and start developing our projects from that location. But wait!, this method is not optimal, as you will face problems when you use git, or try to create or delete new files since the windows drives are sometimes owned by root. Also the file permissions, that are used in ext file system, are not applicable to Windows NTFS. <br>Even if it works, WSL performs poorly, when it has to access the native file system of Windows.(It is also one of the limitations of using WSL which i believe, they have improved in WSL2). Hence, we follow method 2.</p><p><strong>Method 2: Using Windows file system to access files on Linux.</strong><br>Now, we use the default location of files that WSL provides. Accessing files in this way is fast and secure. All files are stored /home/@username in WSL. We can start working on our projects from there just like we do on a Linux Machine. But there’s one small problem, the Linux environment that is provided by WSL has a separate space for running it’s ext file system. This memory space is located on a mapped network drive on Windows which is not easily accessible using our GUI of Windows. And although, if you try harder, you can locate those files, but modifying them from Windows directly can result in unexpected errors or system-crash.<br>So, what if you want to copy some media files in your projects folder from the downloads folder in Windows? Or what if you want to open a html file from your projects folder in WSL? Here’s the solution :<strong>Remote-WSL extension in VSCode </strong>comes to our rescue. Whenever you want to access any particular file on WSL just right-click on the file in file-explorer pane of VSCode and click on “Reveal in Explorer”, which then opens the location of file on the mapped network drive.<br>Just make sure, not to delete the system files or make unnecessary changes other than opening or copying data.</p><p>I have been using WSL for web-development for some time now, and it feels just like working on a pure Linux OS. Without all the hassle of creating a dual-boot system or using a Virtual Machine we get best of both systems. Comfort of Windows and command-line of Linux. 😉</p><p>Have a great and adventurous day!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45715667343a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beautify your Linux Terminal: Ohmyzsh+wsl+Hyper.js!]]></title>
            <link>https://dev-spectre91.medium.com/beautify-your-linux-terminal-ohmyzsh-wsl-hyper-js-240eab435ac5?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/240eab435ac5</guid>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[hyper-js]]></category>
            <category><![CDATA[oh-my-zsh]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[spaceship]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Sun, 17 Jan 2021 19:46:37 GMT</pubDate>
            <atom:updated>2021-06-07T17:03:33.642Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xXLya17BPrU1ppr3ydPkBQ.png" /><figcaption>Spaceship theme on Hyper.js on Windows using Ohmyzsh!</figcaption></figure><p>Do you like the comfort of Windows, but also want to use a cool Linux terminal 💻 ? In this article, we will explore the steps to configure Hyper.js to use Ohmyzsh! with Spaceship theme using wsl on Windows. 😉</p><p>The popularity of Linux among developers, and the fact, that majority of servers on internet use some version of Linux, pushed Microsoft to come up with “wsl- Windows Subsystem for Linux”. With WSL, you can have a minimal version of Linux kernel on your windows OS, even without installing any virtual machine or a dual-boot system.</p><p>Our goal: A 🆒 Linux Terminal shell with auto-completion and auto-suggestion features along with all the awesomeness Linux has to offer.</p><p>Requirements: Windows Operating System with VSCode Editor installed.</p><p>Let’s get started ! (PLease keep patience, when some libraries take time to install 😛)<br><strong><em>Note: Everything between 🏃</em>xyz123<em>🏃 is the code that has to be copied and run on your terminal.<br> &amp; Everything that is between 📋</em>xyz123<em>📋 has to be copied and then added/replaced as mentioned in the respective step.</em></strong></p><p><strong>Step 1</strong>: Enable wsl on Windows : Use <strong>WindowsKey+ X</strong> to run Powershell in elevated mode and paste the following command: <br> <br>🏃 <strong><em>dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart </em></strong>🏃</p><p><strong>Step 2</strong>: Restart Your Machine.</p><p><strong>Step 3</strong>: Install a linux distribution form Microsoft App Store : I prefer Ubuntu (my version is 20.04) and then Launch it.<br> Create a username and password for this OS.</p><p><strong>Step 4</strong>: Update package manager and libraries:<br><strong><em> </em></strong>🏃 <strong><em>sudo apt-get update</em></strong> 🏃<strong><em><br></em></strong> 🏃 <strong><em>sudo apt-get upgrade</em></strong> 🏃</p><p><strong>Step 5</strong>: Now install zsh <br>🏃 <strong><em>sudo apt-get install zsh</em></strong> 🏃<strong><em><br></em></strong> 🏃 <strong><em>zsh </em></strong>🏃<br> Select the option to create an empty .zshrc file by pressing 0 and hitting Enter.</p><p><strong>Step 6</strong>: Install Oh My Zsh: we will use curl to install it. So, make sure curl is installed first. Most probably curl and Git got already installed as we upgraded our libraries .<br> 🏃 <strong><em>sudo apt-get install curl</em></strong> 🏃<strong><em><br></em></strong> 🏃 <strong><em>sh -c “$(curl -fsSL </em></strong><a href="https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh"><strong><em>https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh</em></strong></a><strong><em>)&quot; </em></strong>🏃</p><p>When prompted select <strong>y</strong> to set zsh as your default shell and click Enter.<br> <br><strong>Step 7</strong>: Install spaceship theme for prompt<br> 🏃<strong><em>git clone </em></strong><a href="https://github.com/denysdovhan/spaceship-prompt.git"><strong><em>https://github.com/denysdovhan/spaceship-prompt.git</em></strong></a><strong><em> “$ZSH_CUSTOM/themes/spaceship-prompt” </em></strong>🏃<br> Then, Symlink, spaceship.zsh-theme to your oh-my-zsh custom themes directory<br> 🏃 <strong><em>ln -s “$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme” “$ZSH_CUSTOM/themes/spaceship.zsh-theme”</em></strong> 🏃</p><p><strong>Step 8</strong>: Edit configuration file for zsh<br>🏃 <strong><em>code ~/.zshrc</em></strong>🏃<br> Add the below code at the end of the file.<br>📋 set ZSH_THEME=”spaceship”<br> SPACESHIP_PROMPT_ORDER=(<br> user # Username section<br> dir # Current directory section<br> host # Hostname section<br> git # Git section (git_branch + git_status)<br> hg # Mercurial section (hg_branch + hg_status)<br> exec_time # Execution time<br> line_sep # Line break<br> vi_mode # Vi-mode indicator<br> jobs # Background jobs indicator<br> exit_code # Exit code section<br> char # Prompt character<br> )<br> SPACESHIP_USER_SHOW=always<br> SPACESHIP_PROMPT_ADD_NEWLINE=false<br> SPACESHIP_CHAR_SYMBOL=”❯”<br> SPACESHIP_CHAR_SUFFIX=” “ 📋</p><p><strong>Step 9</strong>: Install Fira Code Font on your system.<br> <a href="https://github.com/tonsky/FiraCode">https://github.com/tonsky/FiraCode</a>. Download the zip file and extract it. Open the <strong>tty </strong>folder and click on each font file and click install. <strong>Select all the fonts on the folder one by one without missing any file. </strong><br> Restart the shell.</p><p><strong>Step 10</strong>: Now install <strong>Hyper terminal</strong> and configure it :<a href="https://hyper.is/">https://hyper.is/</a>. Press <strong>ctrl</strong> + <strong>, <br></strong> This will open hyper.js configuration file. Replace the following code if it exists or create it: <strong>Do not forget to replace the username in shell path with your username, your shell path will be different than mine, do change it!</strong></p><p>📋 fontFamily: ‘“Fira Code”, Menlo, “DejaVu Sans Mono”, “Lucida Console”, monospace’,<br> <br> shell: ‘C:\\Users\\devqu\\AppData\\Local\\Microsoft\\WindowsApps\\ubuntu2004.exe’, <br> <br> shellArgs: [],<br> <br> plugins: [‘hyper-dracula’], 📋</p><p>Restart the hyper terminal.</p><p><strong>Step 11</strong>: Install Plugins:<strong> zsh-completions, zsh-autosuggestions and fast-syntax-highlighting</strong>:</p><p>🏃 <strong><em>sh -c “$(curl -fsSL </em></strong><a href="https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh"><strong><em>https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh</em></strong></a><strong><em>)&quot;</em></strong>🏃</p><p><strong>Step 12</strong>: Configure the zshrc file<br>🏃 <strong><em>code ~/.zshrc</em></strong>🏃<br> Add the following lines at the end of it:<br> 📋zinit light zdharma/fast-syntax-highlighting<br> zinit light zsh-users/zsh-autosuggestions<br> zinit light zsh-users/zsh-completions📋</p><p><strong>Step 13</strong>: Install <strong>wsl remote extension</strong> for vscode, it will update the terminal for VS Code automatically!😃<br> Optionally, you can change the default terminal for local window file system as well :<br> Open vscode config: ctrl + shift +p and add this line to JSON settings file for user</p><p>📋“terminal.integrated.shell.windows”: “C:\\Users\\devqu\\AppData\\Local\\Microsoft\\WindowsApps\\ubuntu2004.exe”,📋</p><p><strong>Step 14</strong>: Installing node on our new ubuntu container, as it can’t access the node installed on windows. <br> First install basic build tools for node-gyp that complies native add-on tools for node: <br>🏃 <strong><em>sudo apt-get install build-essential</em></strong>🏃<br> Then , install node version manager (nvm):<br>🏃<strong><em> curl -o- </em></strong><a href="https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh"><strong><em>https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh</em></strong></a><strong><em> | bash</em></strong> 🏃</p><p><strong>Step 15</strong>: Configure the zshrc file<br>🏃<strong><em> code ~/.zshrc</em></strong>🏃<br> Add the followings line at the end of the file and save it.</p><p>📋export NVM_DIR=”$HOME/.nvm”<br> [ -s “$NVM_DIR/nvm.sh” ] &amp;&amp; \. “$NVM_DIR/nvm.sh”📋</p><p><strong>Step 16</strong>: Install node:<br>🏃 <strong><em>source ~/.zshrc</em></strong>🏃<br>🏃 <strong><em>nvm install — lts</em></strong>🏃<br>🏃 <strong><em>nvm use — lts</em></strong>🏃<br> Check the version of node installed by running the command:<br>🏃 <strong><em>node — version</em></strong>🏃</p><p><strong>Congratulations 🍷 </strong>for configuring your terminal successfully!<br>Optionally, you may also want to remove your username from prompt. To do that edit the zshrc config file :<br>🏃 <strong><em>code ~/.zshrc</em></strong>🏃<br> And comment out the<strong> user</strong> from <strong>spaceship prompt order</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=240eab435ac5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 2: Linux OS Basics]]></title>
            <link>https://dev-spectre91.medium.com/part-2-linux-os-basics-10f44eb23505?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/10f44eb23505</guid>
            <category><![CDATA[gnome]]></category>
            <category><![CDATA[itin]]></category>
            <category><![CDATA[linux-tutorial]]></category>
            <category><![CDATA[linux-file-system]]></category>
            <category><![CDATA[linux-boot-process]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Wed, 09 Dec 2020 21:26:43 GMT</pubDate>
            <atom:updated>2020-12-09T22:25:38.135Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jb13MxOuDTU5gw3EScwTrg.png" /></figure><h3>Getting started</h3><p>Before moving further, we need to have <strong>Linux OS </strong>installed on our machine.<br>If you are a windows user, you can either make your system <strong>dual-boot to Linux or use WSL</strong> to get a taste of Linux or use a live <strong>USB stick</strong>.</p><p>Another option for Windows user is to install <strong>Hyper Terminal</strong>. But in my opinion, having a full OS installed on your machine has more benefits, as you can focus more on the OS part rather than being involved in making the OS features work on Windows. Now, lets move on to the basics.</p><p>If you ever get stuck in Linux, e.g, if you want to know more about some program, command, topic or utility, the “<strong>man”</strong> command will help you. Just type the entity’s name after the man command<strong> : <em>man &lt;name&gt; </em></strong>and you will get the manual page for that entity (if it exists). As we can infer from the following image, <em>man git</em> command produces the manual for git command <em>:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xd83Vd-eGN-NcDfwHLFOTQ.png" /><figcaption>man command</figcaption></figure><p>Few stats about Linux that makes it a winner : 🐧 <br>1. Every <strong>9 out of 10 Supercomputers </strong>and <strong>more than half of world’s servers</strong> run on Linux.<br>2. Every day more than <strong>1 million Linux devices</strong> come alive (Android phones and Televisions)<br>3. Google,Twitter, Facebook are all powered by Linux.<br>4. More than <strong>8000 developers</strong> from across the world have collaborated in the Linux project since 2005.<br>5. <strong>Every hour almost 6 patches </strong>go into Linux project, and <strong>every 3 months a new version of kernel is released</strong>. All this is possible due to a great <strong>community that has grown</strong> around Linux, which is headed by <strong>Linus Torvalds </strong>himself.<br>6. It is used byb<strong>75% of stock market </strong>systems.</p><p>So, it is almost everywhere.</p><p>Now as there are many Linux distributions out there, which one should you get? For beginners and learners, “<a href="https://ubuntu.com/download"><strong>Ubuntu by Canonical</strong></a><strong>” </strong>is a great choice,<strong> </strong>as it has a good community and a huge collection of resources. It is also easy to use and install, which accounts for its popularity in academics.</p><p><strong>Basic Terminology </strong>: <br>You should know<em>:</em><strong><em> Kernel, Boot-loader, Distribution, Service, file-system, X Window system, desktop environment, and command line.</em></strong></p><ol><li><strong>Kernel</strong>: It is the brain of Linux system which control the access to hardware.</li></ol><p>2.<strong> Distribution</strong>: It is a collection of programs and utilities which is packed along with the Linux Kernel. Distribution is the full OS. In common Linux language, it is also known as “distros”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*8mc-OCv8RJvNjiFOwb8jYQ.png" /><figcaption>Linux: Distro graph</figcaption></figure><p>3. <strong>Boot Loader</strong>: It is a program that boots the Operating System. E.g. <strong>GRUB</strong>, ISOLINUX .</p><p>4. <strong>Service </strong>: It is a program that runs as a background process. E.g httpd, ftpd, ntpd and named etc.</p><p>5.<strong> File-System</strong>: A method for organising and storing files in Linux. E.g <strong>ext3,</strong> ext4, FAT, XFS, and Btrfs.</p><p>6. <strong>X Window File system:</strong> It provides the standard toolkit and protocol to build Graphical User Interfaces (GUI’s) for Linux based systems.</p><p>7. <strong>Desktop Environment</strong>: It is a GUI interface on top of Operating system. e.g. <strong>GNOME,</strong> KDE, Fluxbox etc.</p><p>8. <strong>Command Line</strong> : Also known as Terminal. It is an interface to write commands for OS . Often, it is confused with Shell.</p><p>9. <strong>Shell:</strong> A shell is a command line interpreter that interprets the Command Line input and and directs the OS to perform tasks. E.g bash , zsh, ksh, sh etc.</p><p>A <strong>full Linux distribution consists of the kernel plus a number of other software</strong> tools for file-related operations, user management, and software package management.</p><h3>How Linux Boots ?</h3><p>On a <strong>x86 processor </strong>(Short for Intel’s 80x86), a BIOS (Basic Input Output Sytem) which is a firmware loaded on a small ROM chip, initialises the hardware (Keyboard, Screen etc) and then runs a <strong>POST (short for Power On Self Test)</strong></p><p>Then, a <strong>boot loader </strong>takes control form the <strong>BIOS. I</strong>t is located in the boot sector of <strong>MBR (for old systems) and EFI partition on UEFI(newer systems).</strong> The boot loader (on MBR or EFI) searches for a second stage boot loader , <strong>GRUB(Grand Unified Bootloader from GNU)</strong>, which resides under /boot. The GRUB then presents a splash screen which allows the user to select from a list of installed OS’s. The selected OS gets loaded into the <strong>RAM</strong> (the main memory). Now, kernel has full control and it’s first job is to uncompress itself. It then executes <strong>initramfs </strong>which loads relevant drivers by running <strong>udev </strong>program and finds the proper mountable root file-system while checking for errors using the <strong>mount</strong> program.</p><p>Once mounting is successful, initramfs is cleared from RAM , finally, init program is executed which mounts the real file system.</p><p><strong>Init is the root process from where other processes originate(except the essential kernel processes)</strong>. It starts the text-mode login attempts which asks for username and password (if setup), and takes you to the default shell, which commonly is the <strong>BASH shell</strong>. Hence, init is also responsible for cleaning , login and logout in Linux OS.</p><h3>Parallel Computing</h3><p>Most recent systems have stepped away from this sequential startup way, to utilise the power of <strong>parallel computing</strong> and they use <strong>systemd</strong> . So, <strong>systemd replaced the traditional sequential init process.</strong><br>If your OS is shipped with GUI like GNOME or KDE you, won’t see the shell instead you will see a beautiful GUI. (Most distros starts 6 text terminals and one GUI terminal). Congrats, now you have successfully started your Linux OS!</p><h3>File System in Linux:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*ZM7iX_eBVUt-AIlzgyC1TQ.png" /><figcaption>Comparison of file system: Windows vs Linux</figcaption></figure><p>A <strong>partition</strong> is a physically contiguous section of a disk, or what appears to be so in some advanced setups. It acts as a <strong>container for file-system.</strong></p><p>A <strong>file-system</strong> is a method of storing/finding files on a hard disk (usually in a partition)<br>Linux uses a standard layout system for files which is maintained by the Linux Foundation. It does not have drive letter and <strong>Linux uses the ‘/’ </strong>character to separate paths (unlike <strong>Windows, which uses ‘\’</strong>). Drives are mounted as directories in file-system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*Zt70Did0_ZYBFWUQdwbaLQ.jpeg" /><figcaption>Image Source: <a href="https://linuxconfig.org/">www.linuxconfig.org</a></figcaption></figure><p>The ‘<strong>/’ is the root directory</strong> , the <strong>file-system names are case-sensitive</strong>. As we can see from the image, all non-system specific files are placed under the <strong>/usr directory</strong> and the configuration files are under the <strong>/etc directory.</strong></p><p>In the next part, we will see how to use Linux command line and learn some basic commands too. Till then, have a nice and adventurous day! 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10f44eb23505" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying Unix and Linux: Part 1]]></title>
            <link>https://dev-spectre91.medium.com/demystifying-unix-and-linux-part-1-756e0356b5d9?source=rss-4ee8d35fa84c------2</link>
            <guid isPermaLink="false">https://medium.com/p/756e0356b5d9</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[unixlinux]]></category>
            <category><![CDATA[kernel]]></category>
            <category><![CDATA[richard-stallman]]></category>
            <category><![CDATA[shell]]></category>
            <dc:creator><![CDATA[Devanshu Tiwari]]></dc:creator>
            <pubDate>Mon, 07 Dec 2020 20:30:12 GMT</pubDate>
            <atom:updated>2020-12-09T17:58:36.697Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 1: Demystifying Unix &amp; Linux</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*eFm1fthD7CvHpaaSNFo1Xg.png" /></figure><p>In these four parts i will try to cover all the essentials of UNIX, that a beginner needs to know.</p><p><strong><em>Part 1: Demystifying Unix &amp; Linux</em></strong><em><br>Part 2: Linux OS Basics<br>Part 3: Basic Linux Commands<br>Part 4: Shell Scripting in Linux</em></p><h3>Unix vs Linux : What the hell is this POSIX?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2XlFHSkrOC0aYqiSZytuzA.jpeg" /><figcaption>DEC’s PDP-7, 1965</figcaption></figure><p>The image contains a <strong>PDP-7 </strong>mini-computer developed by <strong>DEC(Digital Equipments Corporation) in 1965</strong>, for which the UNIX Operating system was written by Kenn Thompson and Dennis Ritchie at Bell Labs. First time in history, an OS had multi-user and multi-tasking capability. Unix’s popularity rose when it was refactored using<strong> C</strong> making it <strong>portable.</strong></p><p>Its modular philosophy and portability, took it beyond <strong>Bell Lab</strong>s to academics, research and commercial use. It was UNIX, which stared piping i/o of programs to a linear set of operations on input (<strong>Piping</strong>: Using output of one command as a input to another command, `|` symbol is used to achieve this).</p><p>In <strong>1970’</strong>s , a new Unix distribution became popular in academics, specifically at Berkeley, from where the “<strong>Berkeley Software Distribution (BSD)</strong>” came. The C shell and vi programs were added to Unix at Berkeley making BSD more useful and versatile. Interestingly, <strong>Apple’s OS-X (now known as macOS</strong>) is a also a derivative of BSD.</p><p>Unix’s commercial success reached new heights in <strong>1980s to 1990’s </strong>with coming of many commercial <strong>distros</strong> (short for distributions) like <strong>Sun Solaris, Xenix, HP-UX, IBM’s AIX, Sequent etc</strong>. People called it an era of “UNIX-wars”. With so many versions of Unix out there, standardisation was inevitable. It was then , <strong>The Open Group</strong> came with the <strong>POSIX</strong> standard in 1988.</p><p><strong>The rise of Open Source :</strong><a href="https://en.wikipedia.org/wiki/Richard_Stallman"><strong> Richard Stallman’</strong></a><strong>s “GNU movement”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zjpPI2ShIqIP_seyUttEoA.jpeg" /><figcaption>GNU to Linux= You complete me!</figcaption></figure><p><strong>GNU is a recursive acronym for ‘GNU’s not UNIX’ </strong>coined by<strong> Richard Stallman </strong>who proposed a free alternate <strong>open source</strong> OS, against the contemporary proprietary Unix. He had written GNU tools (like <a href="https://en.wikipedia.org/wiki/GNU_Compiler_Collection"><strong><em>gcc</em></strong></a><strong><em>)</em></strong> but without a kernel the dream of an OS was distant. But luckily, <strong>Linus Torvalds </strong>that time was working on a project popularly known as <strong>The Linux Project (Linux Kernel)</strong> Contrary to the popular belief that Linux is an Operating system, the term <strong>Linux actually refers to the Linux Kernel</strong>. In addition to MIT’s X-Window GUI , these two were a perfect match for each other and later amalgamated to become the most successful and popular OS of all time- “The Linux OS”. This Linux revolution gave birth to hundreds of distros , including <strong>Canonical’s Ubuntu, Red Hat Linux, Fedora</strong> to name a few. From <strong>Android</strong> to almost all <strong>embedded systems</strong> like smart-watches, smart-TVs, washing machines etc use some variant of Linux as their Operating System . Even <strong>Raspberry’s Pi, </strong>which is an OS<strong> </strong>platform for <strong>IoT Devices, is based on Linux</strong>. And lets not forget the majority of cloud services and servers still rely on Linux. Still not convinced? <strong><em>Google `WSL`</em></strong> 😆</p><h3>What is the relationship between Kernel, Shell and Hardware?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*iZoGZ7P5wIY2ep12mcwT2g.jpeg" /><figcaption>Kernel and Shell in OS</figcaption></figure><p><strong>Kernel: </strong>“It is a portion of a Operating system’s code that<em> always resides in memory</em>”. What this means is that the kernel has exclusive control over hardware, as it has direct access to it. As evident from the above diagram, if you need to communicate with hardware you need to communicate to the kernel first. <strong>It sits between you and the hardware</strong>. Most kernels uses two modes : The user mode and the kernel mode. In <strong>kernel mode</strong> the executing code has unrestricted access to the hardware, on the other hand in <strong>user mode</strong> it need to access the hardware using system API’s. This isolation helps in keeping the system running even when some part of it meets a crash.</p><p><strong>Shell</strong>: Shell <strong>provides us a environment </strong>to run commands. Mostly it starts with a prompt `<strong>$</strong>` which means it is ready to accept a command. After you press Enter it reads your command and executes it if there is no error. <br>Some popular shells that you may encounter are : <strong>korn shell(ksh), bourne-shell(sh),bourne-again shell (bash), z-shell(zsh) etc</strong>.</p><p>In the next part, we will see <strong>how beautiful a shell can be</strong>! Till then, have an adventurous day… 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=756e0356b5d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>