<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Harsh Pandhe</title>
    <description>The latest articles on Forem by Harsh Pandhe (@harshpandhe).</description>
    <link>https://forem.com/harshpandhe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1175047%2F9babc2b0-f954-46a7-a2b4-d5868593a353.jpeg</url>
      <title>Forem: Harsh Pandhe</title>
      <link>https://forem.com/harshpandhe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/harshpandhe"/>
    <language>en</language>
    <item>
      <title>GitHub Bootcamp: Day 5 – Contributing to Open Source Like a Pro 🧑‍💻🌍</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Thu, 22 May 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/github-bootcamp-day-5-contributing-to-open-source-like-a-pro-4lje</link>
      <guid>https://forem.com/harshpandhe/github-bootcamp-day-5-contributing-to-open-source-like-a-pro-4lje</guid>
      <description>&lt;p&gt;Welcome to the final day of our GitHub crash course! Today’s topic is a favorite among devs and job recruiters alike — &lt;strong&gt;Open Source Contributions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Yes, it sounds intimidating. But trust me — you don’t need to be a 10x developer or a command-line wizard to contribute meaningfully. Let’s break it down!&lt;/p&gt;




&lt;h2&gt;
  
  
  🌱 Why Contribute to Open Source?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Learn by doing&lt;/strong&gt; – Hands-on experience beats theory any day.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build your portfolio&lt;/strong&gt; – Real-world code &amp;gt; tutorial projects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Grow your network&lt;/strong&gt; – Meet collaborators, mentors, and friends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Give back to the community&lt;/strong&gt; – Many of the tools you use daily are open source!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgmgtle12vyp161osilz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftgmgtle12vyp161osilz.jpg" alt="Github" width="786" height="443"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔍 How to Find Projects to Contribute To
&lt;/h2&gt;

&lt;h3&gt;
  
  
  💡 Start here:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/search?q=label%3A%22good+first+issue%22" rel="noopener noreferrer"&gt;Good First Issue&lt;/a&gt;&lt;/strong&gt; – Curated list of beginner-friendly issues&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://up-for-grabs.net/" rel="noopener noreferrer"&gt;Up-for-Grabs&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/firstcontributions/first-contributions" rel="noopener noreferrer"&gt;First Contributions Repo&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explore trending repos on GitHub&lt;/strong&gt; – Look under the “issues” tab for low-hanging fruit.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ✅ What Can You Contribute?
&lt;/h2&gt;

&lt;p&gt;You don’t need to refactor the entire codebase. Open source thrives on &lt;strong&gt;small, meaningful contributions&lt;/strong&gt;. Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fixing typos in documentation&lt;/li&gt;
&lt;li&gt;Improving README files&lt;/li&gt;
&lt;li&gt;Updating dependencies&lt;/li&gt;
&lt;li&gt;Fixing bugs&lt;/li&gt;
&lt;li&gt;Adding tests&lt;/li&gt;
&lt;li&gt;Suggesting features&lt;/li&gt;
&lt;li&gt;Reviewing other people’s PRs&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛠️ How to Make a Contribution (The Friendly Way)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Fork the repo&lt;/strong&gt; 🍴&lt;br&gt;
Creates your own copy where you can make changes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clone it locally&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   git clone https://github.com/your-username/project-name.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a new branch&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   git checkout -b fix-typo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Make your changes &amp;amp; commit&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   git add .
   git commit -m "Fix typo in README"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Push to your fork&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   git push origin fix-typo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Open a Pull Request (PR)&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Explain what you did clearly.&lt;/li&gt;
&lt;li&gt;Be polite and open to feedback!&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💬 Pro Tips for Contributing
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Read the &lt;strong&gt;Contributing.md&lt;/strong&gt; file if available.&lt;/li&gt;
&lt;li&gt;Follow &lt;strong&gt;code style guidelines&lt;/strong&gt; of the project.&lt;/li&gt;
&lt;li&gt;Engage positively in issue discussions.&lt;/li&gt;
&lt;li&gt;Be patient — maintainers are often volunteers!&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Bonus: Hacktoberfest
&lt;/h2&gt;

&lt;p&gt;Every October, GitHub and DigitalOcean host &lt;strong&gt;Hacktoberfest&lt;/strong&gt;, where contributing to open source earns you swag, stickers, and GitHub street cred. Perfect for beginners!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkd5tu83a0jr5rh7ejha.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffkd5tu83a0jr5rh7ejha.jpg" alt="Github" width="800" height="1076"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🏁 That’s a Wrap!
&lt;/h2&gt;

&lt;p&gt;You just finished a 5-day journey covering:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is GitHub&lt;/li&gt;
&lt;li&gt;Setting up GitHub &amp;amp; Git&lt;/li&gt;
&lt;li&gt;Branching and Collaboration&lt;/li&gt;
&lt;li&gt;GitHub Actions for Automation&lt;/li&gt;
&lt;li&gt;Open Source Contributions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Whether you're building solo or contributing globally, GitHub is your dev playground.&lt;/p&gt;

</description>
      <category>github</category>
      <category>opensource</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>GitHub Series: Day 4 – Automate Like a Boss with GitHub Actions 🤖⚙️</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Wed, 21 May 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/github-series-day-4-automate-like-a-boss-with-github-actions-22o1</link>
      <guid>https://forem.com/harshpandhe/github-series-day-4-automate-like-a-boss-with-github-actions-22o1</guid>
      <description>&lt;p&gt;Welcome back, developers! Yesterday, we learned how to branch and merge like Git ninjas. Today, we’re going full automation mode with &lt;strong&gt;GitHub Actions&lt;/strong&gt; — your new best friend for building, testing, and deploying code without lifting a finger (well, almost 😎).&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 What are GitHub Actions?
&lt;/h2&gt;

&lt;p&gt;Imagine having a robot that checks your code, runs tests, deploys apps, makes you coffee (okay, not that last one… yet) — all triggered by events like pushing to a branch or opening a pull request.&lt;br&gt;
That’s &lt;strong&gt;GitHub Actions&lt;/strong&gt;. It's a powerful CI/CD (Continuous Integration / Continuous Deployment) system built right into GitHub.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwodiz7rngnwwfbalahjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwodiz7rngnwwfbalahjn.png" alt="Github" width="800" height="384"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  🔥 Why Use GitHub Actions?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ Automate repetitive tasks&lt;/li&gt;
&lt;li&gt;🧪 Run tests every time code is pushed&lt;/li&gt;
&lt;li&gt;🚀 Deploy apps automatically&lt;/li&gt;
&lt;li&gt;📦 Build and publish packages&lt;/li&gt;
&lt;li&gt;🤝 Boost collaboration with teams&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  🛠️ Setting Up Your First GitHub Action
&lt;/h2&gt;

&lt;p&gt;Here’s how to build a simple GitHub Action that runs tests when code is pushed:&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Create a workflow file
&lt;/h3&gt;

&lt;p&gt;Inside your repo, make this folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.github/workflows/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then create a file like &lt;code&gt;ci.yml&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Add this starter config:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run Python Tests&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;push&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;test&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;

    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Checkout code&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v3&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Set up Python&lt;/span&gt;
        &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/setup-python@v4&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;python-version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3.10'&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Install dependencies&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pip install -r requirements.txt&lt;/span&gt;

      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Run tests&lt;/span&gt;
        &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pytest&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And boom — your tests will now run automatically whenever you push code!&lt;/p&gt;




&lt;h2&gt;
  
  
  🚦 Common Use Cases
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Use Case&lt;/th&gt;
&lt;th&gt;Trigger&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Linting&lt;/td&gt;
&lt;td&gt;&lt;code&gt;on: push&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Auto-check code style (e.g., with ESLint or Black)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deployment&lt;/td&gt;
&lt;td&gt;&lt;code&gt;on: push to main&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deploy app to Vercel, Heroku, Netlify, etc.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Notifications&lt;/td&gt;
&lt;td&gt;&lt;code&gt;on: issues&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Send Slack or Discord alerts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Testing&lt;/td&gt;
&lt;td&gt;&lt;code&gt;on: pull_request&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Run unit tests before merging&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🧩 Pro Tip: Use Actions from the Marketplace
&lt;/h2&gt;

&lt;p&gt;Why reinvent the wheel? Head over to &lt;a href="https://github.com/marketplace?type=actions" rel="noopener noreferrer"&gt;GitHub Marketplace&lt;/a&gt; and use thousands of pre-built actions.&lt;/p&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;actions/checkout&lt;/code&gt; → Pulls repo code&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;actions/setup-node&lt;/code&gt; → Sets up Node.js&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docker/build-push-action&lt;/code&gt; → Builds &amp;amp; pushes Docker images&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2kqhzarq6whxvp2hzy63.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2kqhzarq6whxvp2hzy63.png" alt="Github" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;✅ Keep workflows small and focused&lt;/li&gt;
&lt;li&gt;🔁 Use reusable workflows to avoid duplication&lt;/li&gt;
&lt;li&gt;🧪 Run tests &lt;em&gt;before&lt;/em&gt; deploying&lt;/li&gt;
&lt;li&gt;⏱️ Don’t trigger workflows on every tiny change — be specific with paths and branches&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Conclusion
&lt;/h2&gt;

&lt;p&gt;GitHub Actions is your personal DevOps assistant. Whether you're solo-building a portfolio site or working in a team on a massive app, automation will save your time and sanity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tomorrow?
&lt;/h3&gt;

&lt;p&gt;We’ll wrap this series with something close to every developer’s heart — &lt;strong&gt;Open Source Contributions&lt;/strong&gt; 💖&lt;br&gt;
How to find cool projects, make meaningful PRs, and become a contributor!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>github</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>GitHub Bootcamp: Day 3 - Branching and Merging Like a Pro</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Tue, 20 May 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/github-bootcamp-day-3-branching-and-merging-like-a-pro-1ecc</link>
      <guid>https://forem.com/harshpandhe/github-bootcamp-day-3-branching-and-merging-like-a-pro-1ecc</guid>
      <description>&lt;p&gt;Welcome to &lt;strong&gt;Day 3&lt;/strong&gt; of our GitHub series! Today we're diving into &lt;strong&gt;branching and merging&lt;/strong&gt;—the secret sauce behind collaborative development. If GitHub was a movie, branches would be the plot twists, and merges would be the dramatic reunions. Let's get into it!&lt;/p&gt;




&lt;h2&gt;
  
  
  🌐 What is a Branch?
&lt;/h2&gt;

&lt;p&gt;A branch in Git is like a sandbox where you can work on changes without affecting the main (production) version of your code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F09l05cwc2rkoddh72wf1.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F09l05cwc2rkoddh72wf1.webp" alt="Github" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine you're writing a novel. Your main branch is the final version, but you want to try out an alternate ending. Instead of rewriting everything, you create a branch called &lt;code&gt;alternate-ending&lt;/code&gt; and work there. Genius, right?&lt;/p&gt;

&lt;h3&gt;
  
  
  🔄 Creating a Branch
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch feature-cool-button
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🚀 Switching to Your Branch
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout feature-cool-button
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OR&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch feature-cool-button
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you're in your own bubble. Make changes, commit them, and live your best dev life.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✨ Merging: The Reunion Episode
&lt;/h2&gt;

&lt;p&gt;Once you’re happy with your changes in a branch, it’s time to bring them back into the &lt;code&gt;main&lt;/code&gt; branch. That’s merging.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9ep83vxmqy7me8v92hz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe9ep83vxmqy7me8v92hz.jpg" alt="Github" width="800" height="503"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🔐 First, Switch to Main
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  🔄 Merge Your Branch
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git merge feature-cool-button
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Boom! Your changes are now part of the main storyline.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚠️ What About Merge Conflicts?
&lt;/h2&gt;

&lt;p&gt;Sometimes Git gets confused if the same part of a file has been changed in both branches. It’ll raise a &lt;strong&gt;merge conflict&lt;/strong&gt; and ask you to resolve it.&lt;/p&gt;

&lt;p&gt;Don't panic.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git will mark the conflicts in the file.&lt;/li&gt;
&lt;li&gt;You decide which version to keep.&lt;/li&gt;
&lt;li&gt;After editing, mark the conflict as resolved:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add conflicted-file.js
git commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🎓 Pro Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Name your branches clearly: &lt;code&gt;bugfix-login-issue&lt;/code&gt;, &lt;code&gt;feature-dark-mode&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Always pull latest changes before you merge.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;git log --graph&lt;/code&gt; to visualize branches.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;git status&lt;/code&gt; to stay aware of what’s going on.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🤖 Pull Requests: Collaborate the GitHub Way
&lt;/h2&gt;

&lt;p&gt;If you're working with a team or contributing to open source, don’t just merge directly. Open a &lt;strong&gt;pull request&lt;/strong&gt; on GitHub.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcrtgyt24s982j4i8z4q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpcrtgyt24s982j4i8z4q.png" alt="Github" width="624" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;It allows others to review your code.&lt;/li&gt;
&lt;li&gt;You can discuss changes before merging.&lt;/li&gt;
&lt;li&gt;Ensures cleaner, safer code.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🌟 Summary
&lt;/h2&gt;

&lt;p&gt;Branching and merging are powerful tools for working independently without chaos. Master these, and you’re halfway to becoming a Git wizard.&lt;/p&gt;

&lt;h3&gt;
  
  
  Coming Up: Day 4 - GitHub Actions ✨
&lt;/h3&gt;

&lt;p&gt;Next, we’ll explore how to automate workflows and save time with &lt;strong&gt;GitHub Actions&lt;/strong&gt;. Get ready for some dev magic!&lt;/p&gt;

&lt;p&gt;#GitHub #Git #VersionControl #GitTips #CodeCollaboration #OpenSource&lt;/p&gt;

</description>
      <category>github</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>GitHub Bootcamp: Day 2 - Setting Up GitHub</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Mon, 19 May 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/github-for-developers-day-2-setting-up-github-hh6</link>
      <guid>https://forem.com/harshpandhe/github-for-developers-day-2-setting-up-github-hh6</guid>
      <description>&lt;p&gt;Welcome to &lt;strong&gt;Day 2&lt;/strong&gt; of our 5-day GitHub series! Today we’re setting up GitHub, the digital garage where developers store, collaborate on, and show off their code. If GitHub were a superhero, it’d be Batman: mysterious, powerful, and full of cool gadgets (like Actions and Pull Requests). Let's get you set up and ready to push code like a pro.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1: Create a GitHub Account&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Go to &lt;a href="https://github.com" rel="noopener noreferrer"&gt;github.com&lt;/a&gt; and hit &lt;strong&gt;Sign up&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnmror7s1ci2bv44umtvj.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnmror7s1ci2bv44umtvj.webp" alt="Github" width="640" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pick a memorable username (bonus points for geeky puns).&lt;/li&gt;
&lt;li&gt;Add your email and a strong password.&lt;/li&gt;
&lt;li&gt;Choose your plan (the free one is plenty to get started).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You're officially a GitHubber now. 🎉&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 2: Create Your First Repository&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A repository (or “repo”) is where your project lives—kind of like a folder, but cooler.&lt;/p&gt;

&lt;h3&gt;
  
  
  How to Create a Repo:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Click the &lt;strong&gt;+&lt;/strong&gt; icon on the top-right → &lt;strong&gt;New repository&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Give it a name like &lt;code&gt;awesome-project&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Add a description (optional but classy).&lt;/li&gt;
&lt;li&gt;Choose public (anyone can see) or private (for your eyes only).&lt;/li&gt;
&lt;li&gt;Check &lt;strong&gt;“Initialize this repository with a README”&lt;/strong&gt; if you want to add one.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create repository&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faykiqxihx47ytzomzjjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faykiqxihx47ytzomzjjn.png" alt="Github" width="800" height="624"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Boom. Your project home is ready.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 3: Install Git Locally&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;To push code from your computer to GitHub, you’ll need Git installed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install Git:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Windows&lt;/strong&gt;: &lt;a href="https://git-scm.com/download/win" rel="noopener noreferrer"&gt;Download Git&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;macOS&lt;/strong&gt;: Use Homebrew → &lt;code&gt;brew install git&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux&lt;/strong&gt;: Use your package manager → &lt;code&gt;sudo apt install git&lt;/code&gt; (for Debian/Ubuntu)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9qk8in333jz3bb8mrr6y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9qk8in333jz3bb8mrr6y.png" alt="Github" width="800" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure Git:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.name &lt;span class="s2"&gt;"Your Name"&lt;/span&gt;
git config &lt;span class="nt"&gt;--global&lt;/span&gt; user.email &lt;span class="s2"&gt;"your@email.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Git who you are (like a signature on your code).&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 4: Push Your Code to GitHub&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s say you created a project on your computer called &lt;code&gt;hello-github&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Push it to GitHub:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;hello-github
git init
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit"&lt;/span&gt;
git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
git remote add origin https://github.com/yourusername/hello-github.git
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5b242dq00fgyjgf19ew0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5b242dq00fgyjgf19ew0.png" alt="Github" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And boom 💥 your code is now live on GitHub!&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;GitHub UI Tips for Beginners&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;README.md&lt;/strong&gt;: A welcome message for your repo. Make it fun and informative.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Commits Tab&lt;/strong&gt;: Shows your code history like a time-travel diary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Branches&lt;/strong&gt;: Parallel universes for your code. We’ll talk more tomorrow!&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Bonus: Learn Git Basics&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Here are a few must-know Git commands:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git status&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Check what’s going on&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git add .&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Stage all changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git commit -m "message"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Save changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git push&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Upload changes to GitHub&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;git pull&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fetch latest code&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Today you created a GitHub account, made a repo, and learned how to push your first code. You’re officially dangerous (in a good way).&lt;/p&gt;

&lt;h3&gt;
  
  
  What’s Coming Next?
&lt;/h3&gt;

&lt;p&gt;Tomorrow, we dive into &lt;strong&gt;Branching and Merging&lt;/strong&gt;—aka how not to break stuff while working with others. Stay tuned!&lt;/p&gt;

&lt;p&gt;#GitHub #Git #DeveloperTools #VersionControl #OpenSource #Day2&lt;/p&gt;

</description>
      <category>github</category>
      <category>programming</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>GitHub Bootcamp: Day 1 - What is GitHub?</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Mon, 19 May 2025 12:45:41 +0000</pubDate>
      <link>https://forem.com/harshpandhe/github-bootcamp-day-1-what-is-github-lg3</link>
      <guid>https://forem.com/harshpandhe/github-bootcamp-day-1-what-is-github-lg3</guid>
      <description>&lt;p&gt;Welcome to &lt;strong&gt;Day 1&lt;/strong&gt; of our 5-day GitHub series! If you've ever heard developers say, "Push it to GitHub" and wondered if they meant a gym workout, you're in the right place.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is GitHub?
&lt;/h2&gt;

&lt;p&gt;GitHub is like social media for code—except instead of selfies and cat memes, you'll find commits, pull requests, and branches. It's a web-based platform built on top of &lt;strong&gt;Git&lt;/strong&gt;, a version control system that helps developers track changes in their code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9ibtuw408xsdfypyvdb.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9ibtuw408xsdfypyvdb.webp" alt="GitHub" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  TL;DR:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Git&lt;/strong&gt; = A tool to track code changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt; = A cloud platform to store, manage, and collaborate on Git repositories.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If Git is your notebook, GitHub is your bookshelf in the cloud.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Use GitHub?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcdbx5n4qr6h3ba9e6rgk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcdbx5n4qr6h3ba9e6rgk.png" alt="GitHub" width="600" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ✨ Features &amp;amp; Benefits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Version Control&lt;/strong&gt;: Never lose progress. Revert to older versions anytime.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Collaboration&lt;/strong&gt;: Work on the same project with friends, teammates, or strangers across the globe.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Issue Tracking&lt;/strong&gt;: Report bugs or suggest features with Issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pull Requests&lt;/strong&gt;: Review, discuss, and merge changes smoothly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation&lt;/strong&gt;: Use README files and Wikis to explain your code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Pages&lt;/strong&gt;: Host static websites directly from your repo.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community and Open Source&lt;/strong&gt;: Find projects, contribute, or get help from fellow devs.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Real-Life Examples
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Solo Developer&lt;/strong&gt;: You’re building a personal portfolio site. GitHub tracks changes and lets you host it using GitHub Pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Startup Team&lt;/strong&gt;: Your team of 5 is working on a web app. Everyone pushes code to the same repo and uses branches to prevent chaos.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Open Source Contributor&lt;/strong&gt;: You find a bug in a cool tool. Fork the repo, fix the bug, and submit a pull request!&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  A Quick Glossary
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Repository (Repo)&lt;/strong&gt;: A project folder tracked by Git.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Commit&lt;/strong&gt;: A snapshot of your project at a specific time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Branch&lt;/strong&gt;: A parallel version of your project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Merge&lt;/strong&gt;: Bringing branches together.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pull Request (PR)&lt;/strong&gt;: Proposing changes to be added to a repo.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0g1jb83tfvswfqrf6sic.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0g1jb83tfvswfqrf6sic.png" alt="Github" width="489" height="605"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thought for Today
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flx61rlu7ia758uxbsywt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flx61rlu7ia758uxbsywt.png" alt="Github" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GitHub isn’t just for developers—it’s for creators. Writers, designers, data scientists, and more use GitHub to manage versioned work. By learning it, you’re joining a global community of builders and innovators.&lt;/p&gt;




&lt;h3&gt;
  
  
  What’s Next?
&lt;/h3&gt;

&lt;p&gt;Tomorrow, we’ll walk you through &lt;strong&gt;Setting Up GitHub&lt;/strong&gt;, creating your first repository, and mastering Git basics. No worries—we'll keep it fun, hands-on, and beginner-friendly.&lt;/p&gt;

</description>
      <category>github</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day 05: System Administration Like a Pro</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Thu, 13 Feb 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/day-05-system-administration-like-a-pro-29g8</link>
      <guid>https://forem.com/harshpandhe/day-05-system-administration-like-a-pro-29g8</guid>
      <description>&lt;p&gt;Welcome to the final day of our Linux series! Today, we’re stepping into the shoes of a Linux System Administrator. You’ll learn how to manage users, processes, and services like a seasoned pro. Ready to level up? Let’s dive in!&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;What is System Administration?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;System administration is all about keeping a Linux system running smoothly. It involves managing users, monitoring processes, configuring services, and ensuring everything works together harmoniously. Think of it as being the conductor of a tech orchestra.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu2w84md07m4j3amdv3x.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnu2w84md07m4j3amdv3x.gif" alt="Image description" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Managing Users and Groups&lt;/strong&gt;
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;1. Add a New User&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Add a user with the &lt;code&gt;adduser&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;adduser username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the prompts to set up a password and basic user info.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Delete a User&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Remove a user with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;deluser username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a clean slate, delete their home directory too:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;deluser &lt;span class="nt"&gt;--remove-home&lt;/span&gt; username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;3. Switch Users&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Switch to another user with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;su - username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;4. Manage Groups&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Add a user to a group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; groupname username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example: Adding &lt;code&gt;jane&lt;/code&gt; to the &lt;code&gt;sudo&lt;/code&gt; group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;jane
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Monitoring and Managing Processes&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Processes are the programs running on your system. Here’s how to keep an eye on them:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. View Running Processes&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;top&lt;/code&gt; to see a live list of running processes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;top
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exit with &lt;code&gt;q&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Or, use &lt;code&gt;ps&lt;/code&gt; for a snapshot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps aux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;2. Kill a Process&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Terminate a misbehaving process with its PID (Process ID):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;kill &lt;/span&gt;PID
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If it refuses to die, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;kill&lt;/span&gt; &lt;span class="nt"&gt;-9&lt;/span&gt; PID
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;3. Monitor System Resources&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Check memory and CPU usage:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;free &lt;span class="nt"&gt;-h&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;uptime&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Managing Services&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Linux services (a.k.a. daemons) are background processes that handle tasks like web servers, databases, and more. Here’s how to manage them:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Start, Stop, and Restart Services&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Control services with &lt;code&gt;systemctl&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start servicename
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl stop servicename
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart servicename
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example: Restarting the Apache web server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart apache2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;2. Check Service Status&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;See if a service is running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl status servicename
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;3. Enable and Disable Services&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Enable a service to start on boot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;servicename
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Disable it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl disable servicename
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Scheduling Tasks with Cron&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Automate repetitive tasks using Cron. Cron jobs are scheduled tasks defined in a special file called the crontab.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Edit the Crontab&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Open the crontab editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;crontab &lt;span class="nt"&gt;-e&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;2. Add a Cron Job&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Cron jobs follow this format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;minute hour day month day_of_week &lt;span class="nb"&gt;command&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example: Run a backup script every day at 2 AM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;0 2 &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; /path/to/backup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;3. List Cron Jobs&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;View your scheduled tasks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;crontab &lt;span class="nt"&gt;-l&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Backing Up Your System&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Backups are a sysadmin’s best friend. Here’s a simple way to back up files and directories:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Using rsync&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rsync &lt;span class="nt"&gt;-av&lt;/span&gt; /source/directory /backup/directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example: Back up your home directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rsync &lt;span class="nt"&gt;-av&lt;/span&gt; /home/username /mnt/backup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Tips and Best Practices&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Keep Your System Updated&lt;/strong&gt;: Use &lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade&lt;/code&gt; (or your distro’s equivalent) regularly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor Logs&lt;/strong&gt;: Check logs for errors and anomalies. System logs are often in &lt;code&gt;/var/log&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limit Root Access&lt;/strong&gt;: Use &lt;code&gt;sudo&lt;/code&gt; instead of logging in as root.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backup Regularly&lt;/strong&gt;: Always have a backup plan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document Everything&lt;/strong&gt;: Keep notes on what you configure for future reference.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Resources to Explore&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://linuxjourney.com/" rel="noopener noreferrer"&gt;Linux System Administration Basics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/jlevy/the-art-of-command-line" rel="noopener noreferrer"&gt;The Art of Command Line&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://linux.die.net/man/" rel="noopener noreferrer"&gt;Linux Man Pages&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Congratulations! You’ve completed the 5-day Linux journey. You’ve gone from learning what Linux is to mastering system administration. Whether you’re managing users, processes, or services, you now have the skills to navigate Linux like a pro.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Keep Learning&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This is just the beginning. Linux is a vast and fascinating world. Keep exploring, practicing, and experimenting. The command line is your canvas—go create something amazing.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>beginners</category>
      <category>cli</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Day 04: Shell Scripting Basics</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Thu, 13 Feb 2025 16:50:10 +0000</pubDate>
      <link>https://forem.com/harshpandhe/day-04-shell-scripting-basics-3ai9</link>
      <guid>https://forem.com/harshpandhe/day-04-shell-scripting-basics-3ai9</guid>
      <description>&lt;p&gt;Welcome to &lt;strong&gt;Day 4&lt;/strong&gt; of our 5-day Linux series! Today, we’re diving into the magical world of &lt;strong&gt;Shell Scripting&lt;/strong&gt;, where you’ll learn how to automate repetitive tasks, write simple scripts, and look like a wizard at the command line. Let’s get scripting!&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyaozoxy644sswlvtx3br.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyaozoxy644sswlvtx3br.gif" alt="Wizard" width="640" height="358"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;What is Shell Scripting?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;shell script&lt;/strong&gt; is like a to-do list for your computer, written in a language your Linux shell understands (like Bash). Instead of typing commands one by one, you can write a script to do it all for you in one go. It’s perfect for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automating tasks like backups and updates.&lt;/li&gt;
&lt;li&gt;Managing files and directories.&lt;/li&gt;
&lt;li&gt;Creating tools to simplify your workflow.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Why Learn Shell Scripting?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Folhy627cqbrxptpzlf5b.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Folhy627cqbrxptpzlf5b.jpg" alt="Shell" width="372" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Saves Time&lt;/strong&gt;: Automate boring, repetitive tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Boosts Productivity&lt;/strong&gt;: Handle complex operations with ease.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It’s Fun&lt;/strong&gt;: Who doesn’t love feeling like a tech wizard?&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Getting Started with Shell Scripting&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s create your first shell script. Follow these steps:&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1: Create a Script File&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Open your terminal and create a new file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nano myscript.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 2: Add the Shebang Line&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The first line of your script should be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Linux to use the Bash shell to interpret the script.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1lp9ut554c7zla56b2nj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1lp9ut554c7zla56b2nj.png" alt="Hello" width="685" height="504"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 3: Write Your First Script&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Add the following code to your file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello, World!"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjipv5hj6obvs7aqszx59.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjipv5hj6obvs7aqszx59.png" alt="hello world" width="690" height="468"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This script will simply print “Hello, World!” to the terminal.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 4: Save and Exit&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Press &lt;code&gt;Ctrl + O&lt;/code&gt;, then &lt;code&gt;Enter&lt;/code&gt; to save. Press &lt;code&gt;Ctrl + X&lt;/code&gt; to exit.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 5: Make the Script Executable&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Run this command to make your script executable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x myscript.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Step 6: Run Your Script&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Finally, execute your script with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./myscript.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Boom! Your first shell script just ran. High five!&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Key Concepts in Shell Scripting&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Variables&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Variables store data that you can use later in your script. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Linux User"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello, &lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="s2"&gt;!"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Conditionals&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Run different commands based on conditions. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$1&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; 10 &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"The number is greater than 10."&lt;/span&gt;
&lt;span class="k"&gt;else
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"The number is 10 or less."&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Note: &lt;code&gt;$1&lt;/code&gt; refers to the first argument passed to the script.)&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqakbqss76tqjf3xjks80.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqakbqss76tqjf3xjks80.png" alt="if" width="640" height="398"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Loops&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Repeat commands using loops. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="k"&gt;for &lt;/span&gt;i &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;1..5&lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
  &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Number: &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Example: Automating a Backup&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s write a script to back up a directory:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;backup.sh&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nv"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/path/to/source"&lt;/span&gt;
&lt;span class="nv"&gt;dest&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/path/to/backup"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Starting backup..."&lt;/span&gt;
&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="nv"&gt;$src&lt;/span&gt; &lt;span class="nv"&gt;$dest&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Backup completed!"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Replace &lt;code&gt;/path/to/source&lt;/code&gt; with the directory you want to back up.&lt;/li&gt;
&lt;li&gt;Replace &lt;code&gt;/path/to/backup&lt;/code&gt; with your backup destination.&lt;/li&gt;
&lt;li&gt;Run the script, and boom—automated backup!&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Best Practices for Shell Scripting&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Add Comments&lt;/strong&gt;: Use &lt;code&gt;#&lt;/code&gt; to explain your code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handle Errors&lt;/strong&gt;: Use &lt;code&gt;set -e&lt;/code&gt; to stop the script on errors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test Your Scripts&lt;/strong&gt;: Run them in a safe environment first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep It Simple&lt;/strong&gt;: Avoid making scripts overly complex.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Resources to Learn More&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://linuxcommand.org/" rel="noopener noreferrer"&gt;Shell Scripting Tutorial by LinuxCommand&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devhints.io/bash" rel="noopener noreferrer"&gt;Bash Scripting Cheatsheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tldp.org/" rel="noopener noreferrer"&gt;The Linux Documentation Project&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You just took your first steps into the exciting world of shell scripting! With practice, you’ll be automating tasks and building your own tools in no time. Keep experimenting and having fun.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What’s Next?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Tomorrow, we’ll wrap up our Linux series with &lt;strong&gt;System Administration&lt;/strong&gt;, where we’ll learn how to manage users, processes, and services like a pro. See you on &lt;strong&gt;Day 5&lt;/strong&gt;!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>shell</category>
      <category>cli</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day 03: The Linux File System</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Tue, 11 Feb 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/day-3-the-linux-file-system-4ldg</link>
      <guid>https://forem.com/harshpandhe/day-3-the-linux-file-system-4ldg</guid>
      <description>&lt;p&gt;Welcome to &lt;strong&gt;Day 3&lt;/strong&gt; of our Linux series! Yesterday, we became command-line ninjas, learning the essentials of navigating and managing files. Today, we’ll explore the Linux file system—an organized chaos of directories that make Linux both powerful and efficient. Ready? Let’s decode this mystery together!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5672rhh0axzxy5ybt8e6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5672rhh0axzxy5ybt8e6.png" alt="Linux file System" width="752" height="384"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Understanding the Linux File System&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Linux file system is like a tree. The root (&lt;code&gt;/&lt;/code&gt;) is the base, and everything branches out from there. Unlike Windows, Linux doesn’t have drive letters (C:\, D:). Instead, all files and directories are part of this single tree structure.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Key Directories in Linux&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let’s take a tour of the Linux file system—a virtual sightseeing trip through the most important directories:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. /&lt;/strong&gt; (Root Directory)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The starting point of the Linux file system.&lt;/li&gt;
&lt;li&gt;All other directories live here.&lt;/li&gt;
&lt;li&gt;Warning: Messing around here without caution can lead to disaster. Treat it like it’s a beehive—observe, but don’t poke!&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. /home&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Home sweet home! Each user has their personal space here (e.g., &lt;code&gt;/home/username&lt;/code&gt;).&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhou76eua4heece7dbiy8.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhou76eua4heece7dbiy8.jpg" alt="Home Sweet Home" width="612" height="438"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This is where you’ll spend most of your time, storing personal files and configurations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. /bin&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Short for “Binaries”—contains essential programs and commands, like &lt;code&gt;ls&lt;/code&gt;, &lt;code&gt;cp&lt;/code&gt;, and &lt;code&gt;mv&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;These are the tools you’ve been using from Day 2!&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. /usr&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Short for “User” resources. Think of it as the treasure chest of user applications and libraries.&lt;/li&gt;
&lt;li&gt;Contains directories like &lt;code&gt;/usr/bin&lt;/code&gt; for user-installed programs and &lt;code&gt;/usr/share&lt;/code&gt; for shared files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgr3nk2ltez4vnwb5g960.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgr3nk2ltez4vnwb5g960.png" alt="User" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;5. /etc&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The configuration headquarters of Linux.&lt;/li&gt;
&lt;li&gt;Contains system-wide settings for programs and services (like &lt;code&gt;/etc/hostname&lt;/code&gt; for the system’s name).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;6. /var&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Stores variable files like logs, databases, and emails.&lt;/li&gt;
&lt;li&gt;Example: Check system logs in &lt;code&gt;/var/log&lt;/code&gt; to troubleshoot problems.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ibvpa558tgdblfrssxc.png" alt="variable" width="647" height="200"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;7. /tmp&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Temporary storage. Files here are automatically deleted after a reboot.&lt;/li&gt;
&lt;li&gt;Useful for storing short-lived data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;8. /dev&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Stands for “Devices.” Contains files that represent hardware devices (e.g., &lt;code&gt;/dev/sda&lt;/code&gt; for your hard drive).
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0u5ekh3ahfavfmgmtu9f.png" alt="Devices" width="713" height="332"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;9. /proc and /sys&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Virtual filesystems providing information about system processes and hardware.&lt;/li&gt;
&lt;li&gt;Example: Check CPU info with:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  cat /proc/cpuinfo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Navigating the Linux File System&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Absolute vs. Relative Paths&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Absolute Path&lt;/strong&gt;: Starts from the root directory (&lt;code&gt;/&lt;/code&gt;). Example: &lt;code&gt;/home/user/Documents&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relative Path&lt;/strong&gt;: Starts from your current directory. Example: &lt;code&gt;Documents&lt;/code&gt; (if you’re already in &lt;code&gt;/home/user&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Common Navigation Commands&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;pwd&lt;/code&gt;: Print your current location.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftdie6h358zxnqw13idvp.png" alt="pwd" width="800" height="546"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ls&lt;/code&gt;: List files in a directory.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;cd&lt;/code&gt;: Change directories.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Example: Move to &lt;code&gt;/var/log&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /var/log
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Working with Files and Directories&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Create a Directory&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir &amp;lt;directory_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  mkdir Projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdu89aizctabxrjofx5a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvdu89aizctabxrjofx5a.png" alt="mkdir" width="512" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Delete a Directory&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rmdir &amp;lt;directory_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;rmdir&lt;/code&gt; for empty directories or &lt;code&gt;rm -r&lt;/code&gt; for directories with content.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  rm -r Projects
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Check Disk Usage&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;du -h
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Shows disk usage in a human-readable format.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  du -h /home
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Check Available Disk Space&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;df -h
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Displays available disk space for each filesystem.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Tips for Navigating Like a Pro&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frre3dmgi1li29blw2nrk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frre3dmgi1li29blw2nrk.png" alt="Navigating Like a Pro" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Use Tab for Auto-Completion&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Press &lt;code&gt;Tab&lt;/code&gt; while typing a file or directory name to auto-complete it. Double &lt;code&gt;Tab&lt;/code&gt; shows options if there are multiple matches.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Hidden Files Start with a Dot&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Files like &lt;code&gt;.bashrc&lt;/code&gt; are hidden. Use &lt;code&gt;ls -a&lt;/code&gt; to see them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Use Aliases for Long Paths&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create shortcuts in your &lt;code&gt;.bashrc&lt;/code&gt; file. Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  alias docs="cd /home/user/Documents"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Fun Linux Fact&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Linux doesn’t just run on computers. It’s in space! The International Space Station uses Linux to control systems and perform experiments. 🚀&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxoh5jx9v1pd6sb1m6xs7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxoh5jx9v1pd6sb1m6xs7.jpg" alt="ISS" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Congratulations! You’ve just uncovered the secrets of the Linux file system. By now, you should feel more confident navigating and working with directories. Keep exploring and practicing these commands to master the Linux filesystem.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What’s Coming Next?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Tomorrow, we’ll dive into &lt;strong&gt;Shell Scripting Basics&lt;/strong&gt; and learn how to automate tasks like a pro. See you for &lt;strong&gt;Day 4&lt;/strong&gt; of this series!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Day 02: Basic Linux Commands</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Mon, 10 Feb 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/day-02-basic-linux-commands-2j71</link>
      <guid>https://forem.com/harshpandhe/day-02-basic-linux-commands-2j71</guid>
      <description>&lt;p&gt;Welcome to &lt;strong&gt;Day 2&lt;/strong&gt; of our Linux series! Yesterday, we dipped our toes into the Linux world. Today, we’re getting hands-on and learning some essential commands. Think of this as learning the language of Linux—simple, powerful, and oddly satisfying.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fufcyln2tzw12m9gig9yj.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fufcyln2tzw12m9gig9yj.jpg" alt="Linux" width="500" height="250"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;What Is the Terminal?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine the terminal as a magic window where you can tell Linux what to do. It’s a bit like texting, but instead of a friend, you’re chatting with your computer. Cool, right?&lt;/p&gt;

&lt;p&gt;To open the terminal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ubuntu&lt;/strong&gt;: Press &lt;code&gt;Ctrl + Alt + T&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fedora&lt;/strong&gt;: Search for “Terminal” in the app menu.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, let’s dive into some commands that will make you feel like a tech wizard.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Basic Navigation Commands&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;These commands help you move around the Linux filesystem. Think of it as learning to walk before you run.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Where Am I?&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pwd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7x2pc5vpdzyxfh33gc06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7x2pc5vpdzyxfh33gc06.png" alt="pwd" width="800" height="546"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prints the current directory (your location in the filesystem).&lt;/li&gt;
&lt;li&gt;Example: "/home/username"&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. What’s Around Me?&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12rc5m524v1zup1ntsk4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12rc5m524v1zup1ntsk4.png" alt="ls" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Lists files and directories in your current location.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;-l&lt;/code&gt; for detailed info or &lt;code&gt;-a&lt;/code&gt; to see hidden files.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ls -la
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;3. Take Me Somewhere Else&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd &amp;lt;directory_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Changes your current directory.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  cd Documents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go back to the previous directory with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  cd ..
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejsjsbgqrgtjtrt0qt1n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejsjsbgqrgtjtrt0qt1n.png" alt="cd" width="800" height="501"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;File Management Commands&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. Show Me the File Content&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat &amp;lt;file_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Displays the contents of a file.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  cat hello.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;5. Create a New File&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch &amp;lt;file_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Creates an empty file.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  touch my_file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;6. Move or Rename a File&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mv &amp;lt;source&amp;gt; &amp;lt;destination&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxq730w1oxeiukh2csqrv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxq730w1oxeiukh2csqrv.png" alt="mv" width="800" height="676"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Moves or renames files.&lt;/li&gt;
&lt;li&gt;Example (rename):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  mv old_name.txt new_name.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example (move):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  mv my_file.txt /home/username/Documents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;7. Copy a File&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp &amp;lt;source&amp;gt; &amp;lt;destination&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Copies files or directories.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  cp hello.txt backup_hello.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;8. Delete a File&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm &amp;lt;file_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Deletes a file.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  rm old_file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Be careful—there’s no trash bin here!&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Permissions: The Linux Security Guard&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Linux files have permissions that determine who can read, write, or execute them.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;9. Check File Permissions&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsdg42s02byzbcdse1df.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvsdg42s02byzbcdse1df.png" alt="ls -l" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shows detailed file info, including permissions.&lt;/li&gt;
&lt;li&gt;Example output:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  -rw-r--r-- 1 user group  123 Jan 1 12:00 hello.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Breakdown:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;r&lt;/code&gt; = read, &lt;code&gt;w&lt;/code&gt; = write, &lt;code&gt;x&lt;/code&gt; = execute.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;10. Change Permissions&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod &amp;lt;permissions&amp;gt; &amp;lt;file_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Changes file permissions.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  chmod 755 script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes the file executable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1tz5yifzeyk7xqxxn16.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz1tz5yifzeyk7xqxxn16.png" alt="chmod" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Other Handy Commands&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;11. Clear the Screen&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Wipes the terminal screen clean, just like hitting refresh.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;12. Who Am I?&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;whoami
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa7s4wlzef2yh8os3ffr9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa7s4wlzef2yh8os3ffr9.png" alt="whoami" width="800" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prints your username. Great for existential crises.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;13. What’s Running?&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;top
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Shows active processes and resource usage.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;q&lt;/code&gt; to quit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;14. Need Help?&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;man &amp;lt;command&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Opens the manual for a command.&lt;/li&gt;
&lt;li&gt;Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  man ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Pro tip: Quit the manual with &lt;code&gt;q&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fde0bce5vmcxci22j2w19.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fde0bce5vmcxci22j2w19.png" alt="Man" width="734" height="462"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Fun Linux Fact&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Did you know the Linux mascot, Tux the penguin, was inspired by a penguin bite Linus Torvalds got at a zoo? 🐧&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feumj2mhi0679fwxgdmbt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feumj2mhi0679fwxgdmbt.png" alt="Zoo" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You now know how to navigate, manage files, and even wield the power of permissions. Linux isn’t so scary anymore, is it? Practice these commands, and soon, you’ll feel right at home in the terminal.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What’s Coming Next?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Tomorrow, we’ll explore the &lt;strong&gt;Linux File System&lt;/strong&gt; and uncover its unique directory structure. Stay tuned for &lt;strong&gt;Day 3&lt;/strong&gt; of this series!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>beginners</category>
      <category>cli</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Day 01: Getting Started with Linux</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Sun, 09 Feb 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/day-01-getting-started-with-linux-538c</link>
      <guid>https://forem.com/harshpandhe/day-01-getting-started-with-linux-538c</guid>
      <description>&lt;p&gt;Welcome to &lt;strong&gt;Day 1&lt;/strong&gt; of our 5-day Linux series! Today, we’ll take our first baby steps into the wonderful world of Linux. If you’ve never used it before, don’t worry—this guide is as beginner-friendly as finding memes on the internet. Let’s get started!&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;What is Linux?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Linux is like the quiet genius in your friend group. It’s been around since 1991, thanks to Linus Torvalds, and powers everything from servers and smartphones to fridges (yes, even your smart fridge might be running Linux). Think of it as the invisible engine behind tech magic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopx7he5rigg2p455x8c4.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fopx7he5rigg2p455x8c4.jpg" alt="Linus Torvalds" width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why Should You Care About Linux?&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It’s Free&lt;/strong&gt;: Who doesn’t love free stuff?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It’s Secure&lt;/strong&gt;: Linux laughs in the face of most viruses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It’s Flexible&lt;/strong&gt;: Want to customize it? Go ahead and make it as unique as your Spotify playlists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It’s Supported by Nerds Worldwide&lt;/strong&gt;: Got a problem? There’s a Linux forum for that.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Popular Linux Distros (a.k.a. Flavors)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Linux comes in various "flavors" (distributions or distros). Imagine it’s ice cream, but instead of chocolate or vanilla, you have Ubuntu or Fedora. Here are some tasty options:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3001xv1re4o8ubqnju7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3001xv1re4o8ubqnju7.png" alt="Linux Distros" width="800" height="439"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;For Beginners:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ubuntu&lt;/strong&gt;: Easy to use. The "vanilla" of Linux (but way cooler).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux Mint&lt;/strong&gt;: If Ubuntu is vanilla, Mint is vanilla with sprinkles.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;For Developers and Pros:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fedora&lt;/strong&gt;: Packed with cutting-edge features. Developers love it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Arch Linux&lt;/strong&gt;: The black coffee of Linux. Great if you like full control.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;For Servers:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CentOS/Rocky Linux&lt;/strong&gt;: Stable and serious, like a business suit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Debian&lt;/strong&gt;: Reliable and solid, like your go-to hoodie.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;How to Try Linux Without Freaking Out&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Here are some easy ways to dip your toes into Linux without committing:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Option 1: Dual Boot&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This lets you run Linux and your current OS side by side. It’s like having both Netflix and Disney+ on one screen.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Option 2: Live USB&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Boot Linux from a USB stick without installing it. Think of it as test-driving a car.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Option 3: Virtual Machine&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Run Linux inside your current OS using tools like VirtualBox. It’s like running a video game in windowed mode.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faboh6h5jhx1ahfdib2j4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faboh6h5jhx1ahfdib2j4.png" alt="Virtual Box" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Installing Ubuntu: The Easy Way&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw2qcerqsbwx6fyzralm8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw2qcerqsbwx6fyzralm8.png" alt="ISO File" width="800" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Download the ISO File&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://ubuntu.com/" rel="noopener noreferrer"&gt;Ubuntu’s official website&lt;/a&gt; and grab the latest version.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Create a Bootable USB Drive&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use tools like &lt;strong&gt;Rufus&lt;/strong&gt; (Windows) or &lt;strong&gt;Etcher&lt;/strong&gt; (Linux/Mac). It’s as easy as burning a music CD (if you remember those).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Boot from USB&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restart your computer and choose to boot from the USB drive. You might need to fiddle with BIOS/UEFI settings, but don’t worry, there are plenty of guides online.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Follow the Wizard&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pick your time zone, keyboard layout, and create a user account. Just click through like you’re signing up for a new app.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Done!&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restart and say hello to Linux. High-five yourself; you did it!&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlngua8dm35ueou366kt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzlngua8dm35ueou366kt.gif" alt="High5" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;First Steps in Linux&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that you’re inside Linux, what’s next? Here’s a quick roadmap:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Explore the Desktop Environment&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;If you’re using Ubuntu, you’ll see the GNOME desktop. Play around! Click things! It’s like Windows, but cooler and free.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Open the Terminal (Don’t Panic)&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The terminal is like Linux’s command center. Open it with &lt;code&gt;Ctrl + Alt + T&lt;/code&gt; and type &lt;code&gt;ls&lt;/code&gt; to see a list of files. Boom, you’re a hacker now.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Install Some Cool Software&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Want to install Chrome? Or VLC? Use this command (replace &lt;code&gt;&amp;lt;package_name&amp;gt;&lt;/code&gt; with what you want):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install &amp;lt;package_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Example: &lt;code&gt;sudo apt install vlc&lt;/code&gt; for the VLC media player.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. Join the Linux Community&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Linux users are like your nerdy best friends who actually want to help. Check out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://askubuntu.com/" rel="noopener noreferrer"&gt;Ask Ubuntu&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reddit.com/r/linux" rel="noopener noreferrer"&gt;Reddit Linux Community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.linux.org/" rel="noopener noreferrer"&gt;Linux.org&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz060nbue20tbnzhgt76m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz060nbue20tbnzhgt76m.png" alt="Linux.org" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Congrats, you just unlocked the first level of the Linux adventure! It’s secure, flexible, and free, and now you know the basics to get started. Who knows? By next week, you might even call yourself a Linux user.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What’s Coming Next?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Tomorrow, we’ll tackle &lt;strong&gt;Basic Linux Commands&lt;/strong&gt;—your ultimate cheat sheet for navigating the Linux world. Stay tuned for &lt;strong&gt;Day 2&lt;/strong&gt; of this series. See you there!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>beginners</category>
      <category>tutorial</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Day 05: Real-World Applications and Best Practices</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Thu, 16 Jan 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/day-5-real-world-applications-and-best-practices-meg</link>
      <guid>https://forem.com/harshpandhe/day-5-real-world-applications-and-best-practices-meg</guid>
      <description>&lt;p&gt;Welcome to &lt;strong&gt;Day 5&lt;/strong&gt; of the Docker Demystified series! In this final installment, we’ll explore &lt;strong&gt;real-world use cases&lt;/strong&gt; of Docker and share actionable &lt;strong&gt;best practices&lt;/strong&gt; for effectively leveraging this powerful tool. Whether you’re deploying apps, running ML models, or modernizing legacy systems, Docker simplifies the process. Let’s dive in!&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Real-World Use Cases of Docker&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Application Development and Deployment&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Docker enables developers to package applications with all their dependencies, ensuring they run consistently across different environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A microservices-based e-commerce platform can containerize services like user management, payment gateways, and order processing for easy scaling and independent updates.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Use Docker Compose for local development and Kubernetes for scalable production deployments.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fakf3y4mgbl9zemayvpl6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fakf3y4mgbl9zemayvpl6.png" alt="Microservices" width="800" height="572"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;2. Continuous Integration and Continuous Delivery (CI/CD)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Docker streamlines CI/CD pipelines by providing a uniform environment for testing and deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Jenkins pipelines using Docker containers to run automated tests and build processes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmsfqpzvvikx6lrzo938v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmsfqpzvvikx6lrzo938v.png" alt="Jenkins pipelines using Docker" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Leverage Docker images as build environments to eliminate inconsistencies between developer machines and CI servers.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;3. Cloud-Native Applications&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Docker is a cornerstone of cloud-native development, enabling portability across cloud providers and environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploying a scalable REST API on AWS Elastic Container Service (ECS) or Google Kubernetes Engine (GKE).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj75pfjw8ph3p9jdorb41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj75pfjw8ph3p9jdorb41.png" alt="Cloud-Native Applications Using Docker" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Optimize your container images by using smaller base images like &lt;code&gt;alpine&lt;/code&gt; to reduce deployment time and storage costs.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;4. Machine Learning and Data Science&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Docker simplifies sharing and reproducing ML experiments by packaging code, libraries, and dependencies into containers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Running Jupyter Notebooks in a Docker container with TensorFlow, Scikit-learn, and Pandas pre-installed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fop8fjeaxw5ivlxv3lzuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fop8fjeaxw5ivlxv3lzuv.png" alt="Machine Learning and Data Science using Docker" width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Use multi-stage builds in your Dockerfile to include only essential libraries in the final image for efficiency.&lt;/p&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;5. Legacy Application Modernization&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Docker helps modernize legacy applications by containerizing them to run on modern infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Running a PHP 5 application in a Docker container with all its dependencies without rewriting the code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb6l3okoroalo7edn6lmz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb6l3okoroalo7edn6lmz.png" alt="PHP 5 application" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Use Docker’s volume feature to persist data for legacy apps without altering their architecture.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Best Practices for Using Docker&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Use Lightweight Base Images&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Choose minimal base images like &lt;code&gt;alpine&lt;/code&gt; to reduce image size and improve build speed.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Keep Dockerfiles Clean and Simple&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Combine commands to minimize layers.&lt;/li&gt;
&lt;li&gt;Use multi-stage builds to separate build and runtime dependencies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Multi-stage build example&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:16&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;build&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package*.json ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm run build

&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; nginx:alpine&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=build /app/dist /usr/share/nginx/html&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;3. Automate Security Scanning&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use tools like Docker’s built-in security scan or Trivy to identify vulnerabilities in images.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. Optimize Resource Usage&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Monitor and limit CPU and memory usage to prevent resource contention.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--cpus&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1.5"&lt;/span&gt; &lt;span class="nt"&gt;--memory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"512m"&lt;/span&gt; my-container
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;5. Version and Tag Images Properly&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tag images clearly (e.g., &lt;code&gt;app:v1.0&lt;/code&gt;, &lt;code&gt;app:latest&lt;/code&gt;) to maintain consistency and traceability.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;6. Use Orchestration Tools&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Use Docker Compose for development and Kubernetes for production to manage complex deployments effectively.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Docker has revolutionized how we develop, test, and deploy applications. From simplifying CI/CD pipelines to enabling cloud-native deployments and modernizing legacy systems, Docker's versatility is unmatched. By following best practices, you can harness its full potential while maintaining efficiency and security.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10scss1yetuvzuqjhplp.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F10scss1yetuvzuqjhplp.gif" alt="See U Soon" width="480" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for joining the &lt;strong&gt;Docker Demystified&lt;/strong&gt; series! 🚢 We hope these insights empower you to integrate Docker confidently into your projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What’s Next?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;This concludes our series, but the learning doesn’t stop here. Experiment, explore, and let Docker elevate your workflows. Got questions or success stories? Share them with us!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>devops</category>
      <category>docker</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day 04: Docker Compose: Managing multi-container applications</title>
      <dc:creator>Harsh Pandhe</dc:creator>
      <pubDate>Wed, 15 Jan 2025 18:30:00 +0000</pubDate>
      <link>https://forem.com/harshpandhe/day-04-docker-compose-managing-multi-container-applications-4hhe</link>
      <guid>https://forem.com/harshpandhe/day-04-docker-compose-managing-multi-container-applications-4hhe</guid>
      <description>&lt;p&gt;As your projects grow in complexity, managing multiple containers manually can become a challenge. This is where Docker Compose comes into play. &lt;/p&gt;

&lt;p&gt;In this article, we’ll explore what Docker Compose is, its benefits, and how to use it to simplify the orchestration of multi-container applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Docker Compose?
&lt;/h2&gt;

&lt;p&gt;Docker Compose is a tool that allows you to define and manage multi-container Docker applications using a simple YAML configuration file. Instead of running multiple &lt;code&gt;docker run&lt;/code&gt; commands, you can use Docker Compose to start, stop, and manage all the containers in your application with a single command.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Benefits of Docker Compose
&lt;/h2&gt;

&lt;p&gt;I. &lt;strong&gt;Simplified Configuration&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define all containers, networks, and volumes in a single &lt;code&gt;docker-compose.yml&lt;/code&gt; file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;II. &lt;strong&gt;Dependency Management&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker Compose ensures containers start in the correct order, respecting dependencies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;III. &lt;strong&gt;Ease of Use&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manage the lifecycle of multi-container applications with commands like &lt;code&gt;docker-compose up&lt;/code&gt; and &lt;code&gt;docker-compose down&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;VI. &lt;strong&gt;Consistency Across Environments&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the same configuration file for development, testing, and production.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Getting Started with Docker Compose
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Docker Compose comes pre-installed with Docker Desktop on Windows and macOS.&lt;/li&gt;
&lt;li&gt;Linux users can install it separately by following the &lt;a href="https://docs.docker.com/compose/install/" rel="noopener noreferrer"&gt;Docker Compose installation guide&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Verify the installation by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7txkrueb7pqu79gwk4bq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7txkrueb7pqu79gwk4bq.png" alt="Checking Docker-Compose Version" width="551" height="64"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Example: A Multi-Container Application
&lt;/h2&gt;

&lt;p&gt;Let’s create a simple application with the following components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Python Flask web application.&lt;/li&gt;
&lt;li&gt;A Redis database.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  1. Define the &lt;code&gt;docker-compose.yml&lt;/code&gt; File
&lt;/h3&gt;

&lt;p&gt;Create a file named &lt;code&gt;docker-compose.yml&lt;/code&gt; in your project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;3.9'&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;web&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="na"&gt;working_dir&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/app&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;.:/app&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;5000:5000"&lt;/span&gt;
    &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;redis&lt;/span&gt;

  &lt;span class="na"&gt;redis&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;redis:alpine&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Add the Flask Application Code
&lt;/h3&gt;

&lt;p&gt;Create a file named &lt;code&gt;app.py&lt;/code&gt; in the same directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;redis&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;6379&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;hello&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;incr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hits&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Hello, Docker Compose! This page has been viewed &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;hits&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;decode&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; times.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;


&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;0.0.0.0&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;port&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Write a Dockerfile
&lt;/h3&gt;

&lt;p&gt;Here’s a simple &lt;code&gt;Dockerfile&lt;/code&gt; to containerize our Python application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; python:3.9-slim&lt;/span&gt;

&lt;span class="c"&gt;# Set the working directory in the container&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="c"&gt;# Copy requirements.txt into the container&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; requirements.txt .&lt;/span&gt;

&lt;span class="c"&gt;# Install dependencies&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--no-cache-dir&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt

&lt;span class="c"&gt;# Copy application code into the container&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="c"&gt;# Set the default command to run the application&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["python", "app.py"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Adding requirements.txt
&lt;/h3&gt;

&lt;p&gt;Ensure your dependencies are listed in a &lt;code&gt;requirements.txt&lt;/code&gt; file. For instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;flask
redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Start the Application
&lt;/h3&gt;

&lt;p&gt;Run the following command in the terminal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fke0gqpns6ociiwyo3vbg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fke0gqpns6ociiwyo3vbg.png" alt="Starting the Application" width="800" height="226"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9nh7qm5mr1ykbg2ha5o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn9nh7qm5mr1ykbg2ha5o.png" alt="Docker-Compose Up" width="800" height="347"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Docker Compose will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pull the required images.&lt;/li&gt;
&lt;li&gt;Create and start the containers.&lt;/li&gt;
&lt;li&gt;Display logs for all containers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhgpcsfbya75o9ix8ttpx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhgpcsfbya75o9ix8ttpx.png" alt="Stopping Using Ctrl+C" width="604" height="105"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Access the Application
&lt;/h3&gt;

&lt;p&gt;Open your browser and navigate to &lt;code&gt;http://localhost:5000&lt;/code&gt;. You’ll see the Flask app running, with Redis tracking the number of visits.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjgf9sk429urcrh2dbguu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjgf9sk429urcrh2dbguu.png" alt="Web-Page" width="800" height="539"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Managing the Application with Docker Compose
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Stop the Application
&lt;/h3&gt;

&lt;p&gt;Use the following command to stop and remove containers, networks, and volumes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose down
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgyg2a5if3i3tfoaouwf4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgyg2a5if3i3tfoaouwf4.png" alt="In Process of Stopping" width="800" height="86"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6y1t87eprehrnywc35vb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6y1t87eprehrnywc35vb.png" alt="Stopped" width="800" height="98"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Running in Detached Mode
&lt;/h3&gt;

&lt;p&gt;To run containers in the background, add the &lt;code&gt;-d&lt;/code&gt; flag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Viewing Logs
&lt;/h3&gt;

&lt;p&gt;View logs for all containers with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose logs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkminv0hgp2lgz9akjcko.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkminv0hgp2lgz9akjcko.png" alt="Docker-Compose Logs" width="800" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or for a specific service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose logs web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu6icn9hfcq81k388nlok.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu6icn9hfcq81k388nlok.png" alt="Docker-Compose logs web" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Docker Compose is a powerful tool for managing multi-container applications, simplifying deployment and orchestration. With just a single YAML file, you can define, manage, and scale your services effortlessly.&lt;/p&gt;

&lt;p&gt;In the next article, we’ll dive into &lt;strong&gt;Docker Use Cases&lt;/strong&gt;, exploring real-world scenarios and best practices for utilizing Docker effectively. Stay tuned!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>docker</category>
      <category>beginners</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
