<?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: Amanda Igwe</title>
    <description>The latest articles on Forem by Amanda Igwe (@amandaigwe).</description>
    <link>https://forem.com/amandaigwe</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%2F3025754%2Fe5f0e753-11a1-4d1f-8fab-e90a6df902f5.jpg</url>
      <title>Forem: Amanda Igwe</title>
      <link>https://forem.com/amandaigwe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/amandaigwe"/>
    <language>en</language>
    <item>
      <title>AWS VPC PROJECT</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Sun, 28 Dec 2025 12:05:23 +0000</pubDate>
      <link>https://forem.com/amandaigwe/aws-vpc-project-e4</link>
      <guid>https://forem.com/amandaigwe/aws-vpc-project-e4</guid>
      <description>&lt;p&gt;&lt;strong&gt;OVERVIEW OF THE AWS VPC PROJECT&lt;/strong&gt;&lt;br&gt;
You heard of cloud, but you do not understand what happens to your confidential data and how the system works. I will break down and explain the architecture that handles everything for you in the cloud.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The VPC (Your Private Network)&lt;/strong&gt;
A VPC is like your own private space on AWS. Nothing gets in or out unless you allow it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two Availability Zones (Backup Locations)&lt;/strong&gt;
Your setup runs in two separate data centers. If one goes down, the other keeps working. Your website stays online.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Public Subnets (The Front Door)&lt;/strong&gt;
These are the parts that connect to the internet. Two things live here:&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NAT Gateway&lt;/strong&gt;: Lets your servers download updates from the internet. Blocks unwanted traffic coming in.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load Balancer&lt;/strong&gt;: Spreads visitor traffic evenly across your servers. No single server gets overloaded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private Subnets (Where Your Servers Live)&lt;/strong&gt;
Your actual servers sit here, hidden from the internet. Visitors cannot reach them directly. They must go through the load balancer first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto Scaling Group (Automatic Server Management)&lt;/strong&gt;
Adds more servers when traffic increases. Removes servers when traffic drops. You only pay for what you need.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How Traffic Moves&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Visitor arrives at the load balancer&lt;/li&gt;
&lt;li&gt;Load balancer sends them to a healthy server&lt;/li&gt;
&lt;li&gt;Server handles the request&lt;/li&gt;
&lt;li&gt;Response goes back to the visitor&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;S3 Gateway Endpoint (Fast File Access)&lt;/strong&gt;&lt;br&gt;
Your servers need files from S3 storage. This creates a direct private connection to S3. Faster and more secure than going through the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BENEFIT&lt;/strong&gt;&lt;br&gt;
Servers are protected behind multiple layers. Traffic spreads evenly. If something breaks, backups take over automatically.&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%2Fe2qh45kqegue1o928bma.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%2Fe2qh45kqegue1o928bma.png" alt=" " width="611" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you understand this architecture, let’s begin with building it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Step1: SET UP
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Go to AWS Console&lt;/li&gt;
&lt;li&gt;Search for VPC&lt;/li&gt;
&lt;li&gt;Click on Create VPC&lt;/li&gt;
&lt;li&gt;Select VPC and more&lt;/li&gt;
&lt;li&gt;Give a name to your project - I used “aws-prod-demo”&lt;/li&gt;
&lt;li&gt;Check the following

&lt;ul&gt;
&lt;li&gt;Number of Availability Zones - 2&lt;/li&gt;
&lt;li&gt;Number of public Subnets - 2&lt;/li&gt;
&lt;li&gt;Number of private Subnets - 2&lt;/li&gt;
&lt;li&gt;Nat Gateways - choose zonal - 1 per AZ&lt;/li&gt;
&lt;li&gt;VPC endpoints - None&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Click create vpc&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%2Fmqpg55hzvbhden07iubt.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%2Fmqpg55hzvbhden07iubt.png" alt=" " width="800" height="435"&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%2F2sjjmf3b6rta5i5jqgyg.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%2F2sjjmf3b6rta5i5jqgyg.png" alt=" " width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Success! we have created our VPC&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%2Fxxnwrjnasn7kfl8wso1b.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%2Fxxnwrjnasn7kfl8wso1b.png" alt=" " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;View your VPC .&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note: Give it few minutes to be available &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%2Fa9rj5y0kcf7h9j7y3i4k.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%2Fa9rj5y0kcf7h9j7y3i4k.png" alt=" " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Create Auto Scaling Group
&lt;/h2&gt;

&lt;p&gt;Auto scaling group helps to scale the servers to any number of ec2 instances automatically  pending the traffic it receives. so it can automatically add extra 2 instances to our default 2 if the need arises.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to your AWS Console, search for EC2&lt;/li&gt;
&lt;li&gt;Go to Auto Scaling Group&lt;/li&gt;
&lt;li&gt;Create Auto Scaling Group&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%2F9ee9bpxu6h7vytnnz8ee.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%2F9ee9bpxu6h7vytnnz8ee.png" alt=" " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First create a launch template&lt;/li&gt;
&lt;li&gt;Name your template and description&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%2Fxd0vzx56zhsko4syqtht.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%2Fxd0vzx56zhsko4syqtht.png" alt=" " width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select Ubuntu as the AMI&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%2F21yy9uy3zyuw0rylg0zo.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%2F21yy9uy3zyuw0rylg0zo.png" alt=" " width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select t2.micro as the instance type - this is for free tier AWS accounts&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%2F0lds75vsr9ahhd2swqae.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%2F0lds75vsr9ahhd2swqae.png" alt=" " width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a key pair, if you have none.&lt;/li&gt;
&lt;li&gt;I used aws_logins, maintained default settings and created it.&lt;/li&gt;
&lt;li&gt;Save your key pair you will need it (automatically downloads when created)&lt;/li&gt;
&lt;li&gt;Select that key pair ( I selected the aws_login)&lt;/li&gt;
&lt;li&gt;Create security group&lt;/li&gt;
&lt;li&gt;Name and describe it (I used aws-prod-demo-sg as the name, and “Allow ssh access” for description)&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%2Fu09apmel4rt384ypz8iw.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%2Fu09apmel4rt384ypz8iw.png" alt=" " width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the Inbound Security Group Rules to set up&lt;/li&gt;
&lt;li&gt;We create this by selecting ssh and source type as anywhere&lt;/li&gt;
&lt;li&gt;Add another rule for the app we are deploying&lt;/li&gt;
&lt;li&gt;Select “custom TCP” and set the port as “8000” and source as “Anywhere”&lt;/li&gt;
&lt;li&gt;Click launch template&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%2F6orqfd5mko7z9c9s05h7.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%2F6orqfd5mko7z9c9s05h7.png" alt=" " width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We have successfully created the template&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%2F6tg7ai45lwhamt5gzp11.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%2F6tg7ai45lwhamt5gzp11.png" alt=" " width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now go back to creating the Auto Scaling group&lt;/li&gt;
&lt;li&gt;Name your Auto scaling group and attach the template we created&lt;/li&gt;
&lt;li&gt;Click next&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%2Fgft709lvpjkztexywhia.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%2Fgft709lvpjkztexywhia.png" alt=" " width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose your VPC&lt;/li&gt;
&lt;li&gt;Select the two private subnets as they are the ones with our application which needs the auto scaling&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%2Fgg3n2wu4jk3jwen722cp.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%2Fgg3n2wu4jk3jwen722cp.png" alt=" " width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep desired capacity as 2 , minimum as 1 and maximum as 4 ( this maximum might come handy during peak seasons where demand is high, causing high traffic to the servers)&lt;/li&gt;
&lt;li&gt;Click next&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%2F2kwvf7brx4yutvacgql9.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%2F2kwvf7brx4yutvacgql9.png" alt=" " width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can add SNS notification to send you an email when this happens but for now I skipped it ( I have other projects showcasing how to use SNS)&lt;/li&gt;
&lt;li&gt;Review and create.&lt;/li&gt;
&lt;li&gt;We have successfully created our Auto Scaling group&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%2Fgfa047q3um5d6v7fqso6.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%2Fgfa047q3um5d6v7fqso6.png" alt=" " width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To confirm that our instances are created and running, let’s check our EC2 instances.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On your AWS Console, search for EC2&lt;/li&gt;
&lt;li&gt;Go to instances to confirm&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%2Fbv0xnvxkclke35gpxi35.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%2Fbv0xnvxkclke35gpxi35.png" alt=" " width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can confirm our EC2 instances are running.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Accessing the Private Subnet using Bastion Host
&lt;/h2&gt;

&lt;p&gt;A bastion host is like the middleman for accessing our application in the private subnet. It simply means that as we are trying to secure unauthorised access to our private subnet, we need to mask the address to securely interact with the applications there and the internet. The Bastion host, as the middleman, says, " Alright, I can stand in as the public subnet to communicate with the private subnet.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to EC2&lt;/li&gt;
&lt;li&gt;Click on instances&lt;/li&gt;
&lt;li&gt;Click on Launch Instances&lt;/li&gt;
&lt;li&gt;Name it -  ”aws-prod-demo-bastion-host”&lt;/li&gt;
&lt;li&gt;Select Ubuntu as the OS&lt;/li&gt;
&lt;li&gt;Select the t2.micro&lt;/li&gt;
&lt;li&gt;Select our key pair as aws_login&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%2Ffwn2jzmd1effrb8go778.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%2Ffwn2jzmd1effrb8go778.png" alt=" " width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In Network Settings, click edit&lt;/li&gt;
&lt;li&gt;Select our own VPC that we created&lt;/li&gt;
&lt;li&gt;By default, it will select the private 1 subnet; change this to the public 1 subnet. (The bastion host should be public as it masks our private subnet ip address by assigning a public ip address for public use.&lt;/li&gt;
&lt;li&gt;Select Enable for Auto-assign public IP&lt;/li&gt;
&lt;li&gt;Create security group&lt;/li&gt;
&lt;li&gt;Name and put a description&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%2Fz4wq8fxq6azlhtz1lixa.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%2Fz4wq8fxq6azlhtz1lixa.png" alt=" " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select launch Instance&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%2F5tvqdul74yolyuwe7do0.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%2F5tvqdul74yolyuwe7do0.png" alt=" " width="800" height="132"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have successfully launched our bastion-host instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: SSH into the EC2 Instances
&lt;/h2&gt;

&lt;p&gt;Now we have to ssh into the bastion host instance and also into our private instances. Let’s go on and communicate with these through our local machine.&lt;/p&gt;

&lt;p&gt;We have to do this using our key value pair “aws_logins” we created (the one that automatically downloaded into our system, remember) it will serve as our login details to access these instances.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to EC2 instances , click on the bastion host instance&lt;/li&gt;
&lt;li&gt;Copy the public IPv4 address&lt;/li&gt;
&lt;li&gt;open your terminal to run the following commands
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# check for where the .pem file aws_login is located at. Mine is at Downloads &lt;/span&gt;

&lt;span class="nb"&gt;ls&lt;/span&gt;                                  &lt;span class="nt"&gt;----&lt;/span&gt;&lt;span class="c"&gt;# to find Downloads folder&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;Downloads                         &lt;span class="nt"&gt;-------&lt;/span&gt; &lt;span class="c"&gt;# to change into the folder&lt;/span&gt;

&lt;span class="nb"&gt;ls&lt;/span&gt; | &lt;span class="nb"&gt;grep &lt;/span&gt;aws_login                    &lt;span class="nt"&gt;---------&lt;/span&gt;&lt;span class="c"&gt;# to grab the .pem file&lt;/span&gt;

&lt;span class="c"&gt;#securely copy the file and insert it into our bastion host.&lt;/span&gt;

 scp &lt;span class="nt"&gt;-i&lt;/span&gt; /Users/igweamanda/Downloads/aws_login.pem  /Users/igweamanda/Downloads/aws_login.pem ubuntu@34.207.137.190:/home/ubuntu
 Press Enter 
&lt;span class="c"&gt;# Please change the 34.207.137.190 to your own IP address by copying the bastion host public subnet address&lt;/span&gt;

&lt;span class="c"&gt;# Now you may experience an error based on public key. To fix this use the command below&lt;/span&gt;

/chmod 400 /Users/igweamanda/Downloads/aws_login.pem   &lt;span class="nt"&gt;---&lt;/span&gt;&lt;span class="c"&gt;#this change the mode and secure the key permissions&lt;/span&gt;

Press Enter
&lt;span class="c"&gt;# recopy this previous command and paste again to copy the .pem file into the instance&lt;/span&gt;

 scp &lt;span class="nt"&gt;-i&lt;/span&gt; /Users/igweamanda/Downloads/aws_login.pem  /Users/igweamanda/Downloads/aws_login.pem ubuntu@34.207.137.190:/home/ubuntu
Press Enter
&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%2F6mty1aow8cm9akm2k0q5.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%2F6mty1aow8cm9akm2k0q5.png" alt=" " width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have successfully copied the pem file into the bastion host.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let’s ssh into the bastion host now
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# use the command to ssh into the bastion host&lt;/span&gt;

ssh &lt;span class="nt"&gt;-i&lt;/span&gt; aws_login.pem ubuntu@34.207.137.190         &lt;span class="c"&gt;#change to your bastion ip address&lt;/span&gt;

Press Enter 

&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%2Fxqds82lmt7g1wje6ucdi.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%2Fxqds82lmt7g1wje6ucdi.png" alt=" " width="800" height="279"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have successfully ssh into the bastion host instance! &lt;/p&gt;

&lt;p&gt;it is time to use this as our middleman to ssh or log in securely into our private subnets to access files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go back to EC2 instances&lt;/li&gt;
&lt;li&gt;Open any of the private instances&lt;/li&gt;
&lt;li&gt;Copy the Private IP address&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%2Fqiv8s25uq2rg6tld4kph.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%2Fqiv8s25uq2rg6tld4kph.png" alt=" " width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Come back to the Terminal&lt;/li&gt;
&lt;li&gt;SSH into it
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; aws_login.pem ubuntu@10.0.128.198      &lt;span class="c"&gt;#which is our private ip address we copied&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%2Ff14hezw4ye2i7hc7mss0.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%2Ff14hezw4ye2i7hc7mss0.png" alt=" " width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the image above, you can see that we are now logged into our private subnet via our bastion host as a middleman.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let’s create a file and run it the server with python
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Create an index.html file &lt;/span&gt;

ubuntu@ip-10-0-128-198:~&lt;span class="nv"&gt;$ &lt;/span&gt;vim index.html

&lt;span class="c"&gt;# press i to insert your file and :wq! to save and exit&lt;/span&gt;

&lt;span class="c"&gt;# run the server using python &lt;/span&gt;

ubuntu@ip-10-0-128-198:~&lt;span class="nv"&gt;$ &lt;/span&gt;python3 &lt;span class="nt"&gt;-m&lt;/span&gt; http.server 8000

&lt;span class="c"&gt;# our application is running on this private instance successfully &lt;/span&gt;
Serving HTTP on 0.0.0.0 port 8000 &lt;span class="o"&gt;(&lt;/span&gt;http://0.0.0.0:8000/&lt;span class="o"&gt;)&lt;/span&gt; ...

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5 : Application Load Balancer
&lt;/h2&gt;

&lt;p&gt;We have our servers running and can communicate or securely log into them. As best practice, we need to consider balancing traffic across both instances. This is the duty of the Application Load Balancer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to AWS Console&lt;/li&gt;
&lt;li&gt;Open EC2&lt;/li&gt;
&lt;li&gt;Go to Load Balancers&lt;/li&gt;
&lt;li&gt;Select the Application Load Balancer&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%2Fob9r21l9rgffnbm5j1sx.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%2Fob9r21l9rgffnbm5j1sx.png" alt=" " width="800" height="437"&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%2Fnq7aq5b2n59w23v6kx59.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%2Fnq7aq5b2n59w23v6kx59.png" alt=" " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name it  — I used “aws-prod-demo-lb&lt;/li&gt;
&lt;li&gt;Select Internet Facing &amp;gt; IPv4&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%2Fknhznt6nhnxj1qtdvt33.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%2Fknhznt6nhnxj1qtdvt33.png" alt=" " width="800" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose the VPC we created from the drop-down&lt;/li&gt;
&lt;li&gt;In Availability Zones, Select the public subnets.&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%2Fhea7r3wcybp7tyzr2lf0.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%2Fhea7r3wcybp7tyzr2lf0.png" alt=" " width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select our vpc security group&lt;/li&gt;
&lt;li&gt;Create Target group &amp;gt; instances&lt;/li&gt;
&lt;li&gt;Name it - aws-prod-demo-tg&lt;/li&gt;
&lt;li&gt;Put the protocol at HTTP and Port at 8000&lt;/li&gt;
&lt;li&gt;Choose our VPC&lt;/li&gt;
&lt;li&gt;Leave the default settings &amp;gt; next&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%2Fikeqdrbmiy7rc0egfajx.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%2Fikeqdrbmiy7rc0egfajx.png" alt=" " width="800" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the two private instances only (do not select the bastion-host)&lt;/li&gt;
&lt;li&gt;Click include as pending&lt;/li&gt;
&lt;li&gt;Click Create Target Group&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%2Fvztwzd2jr3vpaggaax60.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%2Fvztwzd2jr3vpaggaax60.png" alt=" " width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go back to the load balancer to continue creating it&lt;/li&gt;
&lt;li&gt;Attach the target group we have created&lt;/li&gt;
&lt;li&gt;Click on the refresh button close to it to see the target group we created&lt;/li&gt;
&lt;li&gt;Create Load balancer&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%2Fk4u546jga0cd49eqexqi.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%2Fk4u546jga0cd49eqexqi.png" alt=" " width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Give it few secs and refresh to see the active status&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%2F3cb9mg3wlt7fz63s5vhh.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%2F3cb9mg3wlt7fz63s5vhh.png" alt=" " width="800" height="248"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While this is successful, we have an error in the protocol port as “not reachable” remember we used http :80  so let’s fix this.&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%2Fm3mja62ai9jbazkkfwo2.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%2Fm3mja62ai9jbazkkfwo2.png" alt=" " width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go the security tab&lt;/li&gt;
&lt;li&gt;Click on our already created security group&lt;/li&gt;
&lt;li&gt;Click on Edit inbound rules&lt;/li&gt;
&lt;li&gt;Add a new rule for port HTTP : 80&lt;/li&gt;
&lt;li&gt;Source Anywhere : IPv4&lt;/li&gt;
&lt;li&gt;Save&lt;/li&gt;
&lt;li&gt;Come back to the load balancer, refresh it.&lt;/li&gt;
&lt;li&gt;Error is fixed.&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%2Fgek1320uarvaz49fecek.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%2Fgek1320uarvaz49fecek.png" alt=" " width="800" height="434"&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%2Ftsz9oh2gbncp5f6zcsfb.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%2Ftsz9oh2gbncp5f6zcsfb.png" alt=" " width="800" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Testing
&lt;/h2&gt;

&lt;p&gt;Now that everything has been set, it is time to test the app in our private subnet and see it publicly after applying all security rules and features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the DNS address&lt;/li&gt;
&lt;li&gt;Paste on your browser&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Success! &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%2Fz5y7w9ze8i2khb45e7pc.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%2Fz5y7w9ze8i2khb45e7pc.png" alt=" " width="800" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  ERRORS ENCOUNTERED
&lt;/h2&gt;

&lt;p&gt;Well, I had a major roadblock while working on this project. I received a 502 Bad Gateway, and my instances were unhealthy after the health check.&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%2F8ov7f7dmmz7rjhx8dha9.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%2F8ov7f7dmmz7rjhx8dha9.png" alt=" " width="800" height="138"&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%2F9c15ce8l17n3uy4ceo48.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%2F9c15ce8l17n3uy4ceo48.png" alt=" " width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SOLUTIONS
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make sure your index.html file was actually saved. I realised during the project implementation that my file wasn’t saved so nothing was outputting.&lt;/li&gt;
&lt;li&gt;If you are like me who made this tiny mistake, refresh the instances again to correct the health checks&lt;/li&gt;
&lt;li&gt;Give your load balancers time to provision and become active.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In my case, I also had to check my server from the terminal to make sure the ports were communicating. I received a 200 status, which means yes!&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%2Fi8t2ifucbgrfx4sdsn3x.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%2Fi8t2ifucbgrfx4sdsn3x.png" alt=" " width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then refreshed the target group. You can see that one of the instances is healthy as it is the instance where the server is running on.&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%2Fz15wo7clptkabhbc1ebe.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%2Fz15wo7clptkabhbc1ebe.png" alt=" " width="800" height="519"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This project was eye-opening and a lot of struggles reading and troubleshooting. I had my fair share of tears, haha! &lt;/p&gt;

&lt;p&gt;If you try out this project, do let me know your experience too. Hopefully, my article makes it quite easier for you!&lt;/p&gt;

&lt;h2&gt;
  
  
  DELETE!
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Please remember to delete all resources to avoid bearing costs enough to buy a Rolls-Royce! I have an article on my &lt;a href="https://medium.com/@amandaigwe" rel="noopener noreferrer"&gt;Medium page&lt;/a&gt; that helps you do this as well.&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Before you can delete the VPC, you must delete the Auto Scaling group, terminate your instances, delete the NAT gateways, and delete the load balancer.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>bash</category>
      <category>linux</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Day 30/ 30 Days of Linux Mastery: Mastering 'for', 'do', 'while', and 'case' Statements in Shell Scripts</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Sat, 24 May 2025 10:05:06 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-30-30-days-of-linux-mastery-mastering-for-do-while-and-case-statements-in-shell-3ha0</link>
      <guid>https://forem.com/amandaigwe/day-30-30-days-of-linux-mastery-mastering-for-do-while-and-case-statements-in-shell-3ha0</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What Are Loops and Case Statements?&lt;/li&gt;
&lt;li&gt;Core Loops and Case Statements Syntax&lt;/li&gt;
&lt;li&gt;Real-World Scenario: Loops and Case Statements&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 30 of this practical Linux challenge! Part 4/4 of our beginner shell scripting series for RHEL 9.&lt;/p&gt;

&lt;p&gt;If you have ever wanted your Linux system to repeat tasks, check conditions, or handle input differently based on options, then you are ready to meet three of the most powerful tools in shell scripting: &lt;code&gt;for&lt;/code&gt; loops, &lt;code&gt;do&lt;/code&gt;, &lt;code&gt;while&lt;/code&gt; loops, and &lt;code&gt;case&lt;/code&gt; statements.&lt;/p&gt;




&lt;p&gt;&lt;a id="What Are Loops and Case Statements?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Loops and Case Statements?
&lt;/h2&gt;

&lt;p&gt;Loops help you repeat commands without having to type them repeatedly.&lt;/p&gt;

&lt;p&gt;Case statements help you respond to different inputs, like choosing a different action depending on the value a user gives.&lt;/p&gt;

&lt;p&gt;In Bash, we use:&lt;/p&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;for loop: repeat something a certain number of times&lt;/li&gt;
&lt;li&gt;do: Starts the loop block&lt;/li&gt;
&lt;li&gt;while loop: repeat while something is true&lt;/li&gt;
&lt;li&gt;case: handle multiple possible inputs&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;a id="Core Loops and Case Statements Syntax"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Core Loops and Case Statements Syntax
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;for&lt;/code&gt; and &lt;code&gt;do&lt;/code&gt; statement syntax;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;item &lt;span class="k"&gt;in &lt;/span&gt;1 2 3
&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;$item&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;blockquote&gt;
&lt;p&gt;What they do;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;for item in 1 2 3: This means we are looping through the numbers 1, 2, and 3.&lt;/li&gt;
&lt;li&gt;do: This begins the block of code we want to repeat.&lt;/li&gt;
&lt;li&gt;done: This ends the loop block. The loop knows to stop after this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Think of do as “start the loop task” and done as “finish the loop task.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;while&lt;/code&gt; loop statement syntax;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$count&lt;/span&gt; &lt;span class="nt"&gt;-le&lt;/span&gt; 3 &lt;span class="o"&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;"Count is &lt;/span&gt;&lt;span class="nv"&gt;$count&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
   &lt;span class="o"&gt;((&lt;/span&gt;count++&lt;span class="o"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;What they do;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;while [ $count -le 3 ]: This checks if count is 3 or less.&lt;/li&gt;
&lt;li&gt;do: Starts the loop block.&lt;/li&gt;
&lt;li&gt;((count++)): Adds 1 to count each time.&lt;/li&gt;
&lt;li&gt;done: This ends the loop block. The loop knows to stop after this.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;So, the loop runs until count becomes 4.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;case&lt;/code&gt; statement syntax;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Enter a fruit:"&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;fruit

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nv"&gt;$fruit&lt;/span&gt; &lt;span class="k"&gt;in
   &lt;/span&gt;apple&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Apples are red or green."&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
   banana&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Bananas are yellow."&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
   &lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Unknown fruit."&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;What they do;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;read fruit: User types a fruit name.&lt;/li&gt;
&lt;li&gt;case $fruit in: Begins checking value.&lt;/li&gt;
&lt;li&gt;apple), banana): These are the options.&lt;/li&gt;
&lt;li&gt;*): Wildcard — matches anything else.&lt;/li&gt;
&lt;li&gt;;;: Ends each option’s command&lt;/li&gt;
&lt;li&gt;esac : simply means &lt;code&gt;case&lt;/code&gt; spelt backward. Used to end a &lt;code&gt;case&lt;/code&gt; statement.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;a id="Real-World Scenario: Loops and Case Statements"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: Loops and Case Statements
&lt;/h2&gt;

&lt;p&gt;Let’s write a for loop script that checks for a file and let us know if it exists or not.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your terminal, create a file and add this line into it
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim forloop.sh   &lt;span class="c"&gt;# note that script files end with a .sh&lt;/span&gt;

&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="c"&gt;# FOR LOOP EXAMPLE&lt;/span&gt;


&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"FOR loop - Print numbers 1 to 5:"&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="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;span class="c"&gt;# Save and exit using:wq!&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%2Fpx1vehdr5hdsye168p32.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%2Fpx1vehdr5hdsye168p32.png" alt="forloop2 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, give the script permission to run
&lt;/li&gt;
&lt;/ul&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 forloop.sh     &lt;span class="c"&gt;# this enables it to be executable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Verify the file has the execute permissions
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-ltr&lt;/span&gt; forloop.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run the script on your terminal
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./forloop.sh
&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%2F69jj3f2f8f52jmubte0r.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%2F69jj3f2f8f52jmubte0r.png" alt="forloop1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let's practice the &lt;code&gt;while&lt;/code&gt; scenario&lt;/li&gt;
&lt;li&gt;Create a script file, paste the code, or you can write your own now, then grant it the executable permissions.
&lt;/li&gt;
&lt;/ul&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="c"&gt;# While loop Example&lt;/span&gt;


&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;" WHILE loop - Count down from 3:"&lt;/span&gt;
&lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;3
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$count&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; 0 &lt;span class="o"&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;"Countdown: &lt;/span&gt;&lt;span class="nv"&gt;$count&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$((&lt;/span&gt;count &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="k"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;


&lt;span class="c"&gt;# Save and exit using:wq!&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%2Fz9lz4ooklewvzdzzygzz.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%2Fz9lz4ooklewvzdzzygzz.png" alt="while2 description" width="800" height="500"&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%2Fu597j5m6vqj1ntump7j7.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%2Fu597j5m6vqj1ntump7j7.png" alt="while1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;Let's practice the &lt;code&gt;case&lt;/code&gt; scenario&lt;/li&gt;
&lt;li&gt;Create a script file, paste the code, or you can write your own now, then grant it the executable permissions.
&lt;/li&gt;
&lt;/ul&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;"CASE statement - Choose an option:"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Enter a fruit: apple, banana, or mango"&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;fruit

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nv"&gt;$fruit&lt;/span&gt; &lt;span class="k"&gt;in
  &lt;/span&gt;apple&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"You chose Apple"&lt;/span&gt;
    &lt;span class="p"&gt;;;&lt;/span&gt;
  banana&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"You chose Banana"&lt;/span&gt;
    &lt;span class="p"&gt;;;&lt;/span&gt;
  mango&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"You chose Mango"&lt;/span&gt;
    &lt;span class="p"&gt;;;&lt;/span&gt;
  &lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Unknown fruit. Please pick from apple, banana, or mango."&lt;/span&gt;
    &lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;

&lt;span class="c"&gt;# Save and exit using:wq!&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%2F7itp6jdpo9w4vpn26d1u.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%2F7itp6jdpo9w4vpn26d1u.png" alt="case1 description" width="800" height="500"&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%2Ftri1axkq3kpkdt71ud05.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%2Ftri1axkq3kpkdt71ud05.png" alt="case2 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;And that’s it!&lt;/p&gt;

&lt;p&gt;You have now learned how to use &lt;code&gt;for&lt;/code&gt;, &lt;code&gt;do&lt;/code&gt;, &lt;code&gt;while&lt;/code&gt;, and &lt;code&gt;case&lt;/code&gt; statements in your shell scripts. These tools help you make your scripts smarter, more flexible, and powerful.&lt;/p&gt;

&lt;p&gt;Take your time to practice each one, experiment on your terminal, and slowly build confidence. The more you use them, the easier it becomes.&lt;/p&gt;

&lt;p&gt;Keep going, you are doing great! &lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>redhat</category>
      <category>cloudwhistler</category>
      <category>bash</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day 29/ 30 Days of Linux Mastery: if Statements in Shell Scripting for Beginners</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Fri, 23 May 2025 09:05:03 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-29-30-days-of-linux-mastery-if-statements-in-shell-scripting-for-beginners-25eb</link>
      <guid>https://forem.com/amandaigwe/day-29-30-days-of-linux-mastery-if-statements-in-shell-scripting-for-beginners-25eb</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is an &lt;code&gt;if&lt;/code&gt; statement?&lt;/li&gt;
&lt;li&gt;Core &lt;code&gt;if&lt;/code&gt; Statement Syntax&lt;/li&gt;
&lt;li&gt;Real-World Scenario: &lt;code&gt;if&lt;/code&gt; Statement&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 29 of this practical Linux challenge! Part 3 of our beginner shell scripting series for RHEL 9.&lt;/p&gt;

&lt;p&gt;We are looking at the Conditional statements like the &lt;code&gt;if&lt;/code&gt; &lt;code&gt;elif&lt;/code&gt; &lt;code&gt;then&lt;/code&gt; &lt;code&gt;else&lt;/code&gt; statements. &lt;/p&gt;

&lt;p&gt;They allow your script to make decisions based on a condition.&lt;/p&gt;




&lt;p&gt;&lt;a id="What is an  raw `if` endraw  statement?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is an &lt;code&gt;if&lt;/code&gt; statement?
&lt;/h2&gt;

&lt;p&gt;Have you ever made a decision based on a condition? Let's say it is the weekend, and you are planning your rest. You decide that &lt;code&gt;if&lt;/code&gt; it rains, &lt;code&gt;then&lt;/code&gt; you will stay indoors and watch your Netflix, &lt;code&gt;else&lt;/code&gt; you will go out to the cinema. &lt;/p&gt;

&lt;p&gt;Now because you really don't want to go out you add more conditions like &lt;code&gt;if&lt;/code&gt; it rains, &lt;code&gt;then&lt;/code&gt; you will stay indoors and watch your Netflix, &lt;code&gt;elif&lt;/code&gt; its cloudy, &lt;code&gt;then&lt;/code&gt; you have to cancel leaving the house, &lt;code&gt;else&lt;/code&gt; you have no choice but go out to the cinema. &lt;/p&gt;

&lt;p&gt;Simple logic, right? But you have just written a script with conditional statements.&lt;/p&gt;




&lt;p&gt;&lt;a id=" Core  raw `if` endraw  Statement Syntax"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Core &lt;code&gt;if&lt;/code&gt; Statement Syntax
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;elif&lt;/code&gt; statement syntax;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# for if statement &lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; CONDITION &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="c"&gt;# do something&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="c"&gt;# do something else&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;


&lt;span class="c"&gt;# for elif statement&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; CONDITION &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="c"&gt;# do something&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; CONDITION &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;then&lt;/span&gt;
    &lt;span class="c"&gt;# do something again&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="c"&gt;# do something else&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Each part explained:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if [ CONDITION ]: We are checking if something is true&lt;/li&gt;
&lt;li&gt;then: If it is true, do this...&lt;/li&gt;
&lt;li&gt;elif [ CONDITION ]: We are checking if another condition is true&lt;/li&gt;
&lt;li&gt;else: If it is not true, do this instead...&lt;/li&gt;
&lt;li&gt;fi: This is just if spelt backwards, it tells bash that you're done with the condition.&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;a id="Real-World Scenario:  raw `if` endraw  Statement"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: &lt;code&gt;if&lt;/code&gt; Statement
&lt;/h2&gt;

&lt;p&gt;Let’s write a conditional script that checks for a file and let us know if it exists or not.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your terminal, create a file and add this line into it
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim checkfile.sh   &lt;span class="c"&gt;# note that script files end with a .sh&lt;/span&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="nt"&gt;-f&lt;/span&gt; lines.txt &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;"File exists."&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;"File does not exist."&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# Save and exit using:wq!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Flags Meaning&lt;br&gt;
-f : Is it a regular file?&lt;br&gt;
-d : Is it a directory?&lt;br&gt;
-e : Does it exist (file or dir)?&lt;br&gt;
-z : Is the string empty?&lt;/p&gt;
&lt;/blockquote&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%2Fgfunbelym47eqhxwedsa.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%2Fgfunbelym47eqhxwedsa.png" alt="ag2 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, give the script permission to run
&lt;/li&gt;
&lt;/ul&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 checkfile.sh     &lt;span class="c"&gt;# this enables it to be executable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Verify the file has the execute permissions
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-ltr&lt;/span&gt; checkfile.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run the script on your terminal
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;span class="c"&gt;# Now edit the file and alter the name of the file to a file that doesn't exist.&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%2Fthxgn5cgbhip0q2xqc8i.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%2Fthxgn5cgbhip0q2xqc8i.png" alt="ag3 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let's practice the &lt;code&gt;elif&lt;/code&gt; scenario&lt;/li&gt;
&lt;li&gt;Create a script file, paste the code, or you can write your own now, then grant it the executable permissions.
&lt;/li&gt;
&lt;/ul&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;"Enter a number:"&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;num

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$num&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; 100 &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;"That's a big number!"&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$num&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; 50 &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;"That's a medium number."&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;"That's a small number."&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# Save and exit using:wq!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-gt: means greater than&lt;/li&gt;
&lt;li&gt;-lt: means less than&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%2Flezb50d7w73cssvzrbza.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%2Flezb50d7w73cssvzrbza.png" alt="ag5 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&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%2Fbt64g0y14g040phyccqy.png" alt="ag7 description" width="800" height="500"&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Congratulations! &lt;br&gt;
You just learned how to make your bash scripts smart with &lt;code&gt;if&lt;/code&gt;, &lt;code&gt;then&lt;/code&gt;, &lt;code&gt;else&lt;/code&gt;, and &lt;code&gt;elif&lt;/code&gt;. You can now write scripts that react based on conditions. &lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 30!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>cloudwhistler</category>
      <category>redhat</category>
      <category>beginners</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Day 28/ 30 Days of Linux Mastery: Variables and Inputs in Shell Scripting</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Thu, 22 May 2025 13:21:29 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-28-30-days-of-linux-mastery-variables-and-inputs-in-shell-scripting-mp8</link>
      <guid>https://forem.com/amandaigwe/day-28-30-days-of-linux-mastery-variables-and-inputs-in-shell-scripting-mp8</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What are Variables?&lt;/li&gt;
&lt;li&gt;How to Use Variables&lt;/li&gt;
&lt;li&gt;Real-World Scenario: Shell Scripting&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 28 of this practical Linux challenge! Part 2 of our beginner shell scripting series for RHEL 9.&lt;/p&gt;

&lt;p&gt;Shell scripts become truly useful when they can store data, accept user input, and respond accordingly. &lt;/p&gt;

&lt;p&gt;In the previous article, you wrote your first script. Now, let’s make that script interactive by using variables and user inputs.&lt;/p&gt;




&lt;p&gt;&lt;a id="What are Variables?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Variables?
&lt;/h2&gt;

&lt;p&gt;A variable is like a labeled box where you can store information for your script to use later.&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="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Amanda Igwe"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Here, name is the variable, and "Alex" is the value stored in it.&lt;br&gt;
No spaces between variable name, =, and value!&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;a id="How to Use Variables"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Use Variables
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;To create a variable
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;greeting&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Hello!"&lt;/span&gt;   - &lt;span class="c"&gt;# remember no spaces&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;To use the variable, add a $ before it
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$greeting&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;   &lt;span class="c"&gt;# echo means print the variable in greeting&lt;/span&gt;

&lt;span class="c"&gt;# Output:&lt;/span&gt;

Hello! 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;We have two types of variables;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local Variables - This refers to the variables that run in your current shell. If you open another shell, it won't work. For example the variable &lt;code&gt;greeting="Hello!"&lt;/code&gt; will only work in our current terminal no where else.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# local variable example&lt;/span&gt;

&lt;span class="nv"&gt;myname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Amanda"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$myname&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Environment Variables - This refers to the variables that is inherited by any child processes or scripts you run from your current session. It can only stop running if the system is rebooted or terminal is closed. (This can also be made permanent by adding it to your .bashrc or .bash_profile file)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Environment variable example&lt;/span&gt;

&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;myname&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Amanda"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$myname&lt;/span&gt; 

&lt;span class="c"&gt;# to check the environment variables &lt;/span&gt;
&lt;span class="nb"&gt;env&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="Taking Input from Users with read"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Taking Input from Users with read
&lt;/h2&gt;

&lt;p&gt;Now that you have created your variables, your script will in one way or the other request details or information from your user like their name, age, phone number, home address, etc. To get this input we use &lt;code&gt;read&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;echo&lt;/span&gt; &lt;span class="s2"&gt;"What is your name?"&lt;/span&gt;    &lt;span class="c"&gt;# this prints the question&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;name                    &lt;span class="c"&gt;# this collects the user's responses&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;span class="c"&gt;# this prints the user's response inside the variable name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="Real-World Scenario: Shell Scripting"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: Shell Scripting
&lt;/h2&gt;

&lt;p&gt;Let’s write a script that asks for your name and greets you with the date.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your terminal, create a file and this line into it
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim greet.sh   &lt;span class="c"&gt;# note that script files end with a .sh&lt;/span&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;"What is your name?"&lt;/span&gt;
&lt;span class="nb"&gt;read &lt;/span&gt;username

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello, &lt;/span&gt;&lt;span class="nv"&gt;$username&lt;/span&gt;&lt;span class="s2"&gt;! Welcome to Amanda's 30 Days Linux Challenge"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Today is: &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="c"&gt;# Save and exit using:wq!&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%2Fdtsdyc13mizmzub7annw.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%2Fdtsdyc13mizmzub7annw.png" alt="s1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, give the script permission to run
&lt;/li&gt;
&lt;/ul&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 greet.sh     &lt;span class="c"&gt;# this enables it to be executable&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Verify the file has the execute permissions
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-ltr&lt;/span&gt; greet.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run the script on your terminal
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./greet.sh
&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%2F2ijmuwx43e2yuz6865jt.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%2F2ijmuwx43e2yuz6865jt.png" alt="s3 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;By learning how to use variables, collect user input with read, and understand the difference between local and environment variables, you are no longer just running commands; you are interacting with your scripts and making them smarter.&lt;/p&gt;

&lt;p&gt;In the next article, we will explore logic-making decisions using if, else, and conditions inside your script.&lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 29!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>redhat</category>
      <category>cloudwhistler</category>
      <category>bash</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day 27/ 30 Days of Linux Mastery: Introduction to Shell Scripting</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Wed, 21 May 2025 12:08:07 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-27-30-days-of-linux-mastery-introduction-to-shell-scripting-2c8j</link>
      <guid>https://forem.com/amandaigwe/day-27-30-days-of-linux-mastery-introduction-to-shell-scripting-2c8j</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is Shell Scripting?&lt;/li&gt;
&lt;li&gt;Types of Shells&lt;/li&gt;
&lt;li&gt;Real-World Scenario: Shell Scripting&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 27 of this practical Linux challenge! &lt;/p&gt;

&lt;p&gt;If you have been following my articles and practicing your commands on RHEL 9, then you are already using the shell! &lt;/p&gt;

&lt;p&gt;Now, imagine having the shell perform multiple tasks for you automatically. That is what &lt;strong&gt;shell scripting&lt;/strong&gt; is all about.&lt;/p&gt;




&lt;p&gt;&lt;a id="What is Shell Scripting?"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;A &lt;strong&gt;shell&lt;/strong&gt; is a command-line interpreter that lets you interact with the operating system. &lt;strong&gt;Shell scripting&lt;/strong&gt; is the process of writing a series of shell (command-line) instructions in a file that can be executed like a program.&lt;/p&gt;

&lt;p&gt;Think of it like creating your own little tool to automate boring or repetitive tasks!&lt;/p&gt;

&lt;p&gt;With it, you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automate backups&lt;/li&gt;
&lt;li&gt;Monitor system performance&lt;/li&gt;
&lt;li&gt;Create users&lt;/li&gt;
&lt;li&gt;Set scheduled tasks&lt;/li&gt;
&lt;li&gt;Parse logs&lt;/li&gt;
&lt;li&gt;Deploy services&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Types of Shells"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Shells
&lt;/h2&gt;

&lt;p&gt;Linux systems support several types of shells. The most commonly used ones include:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Shell&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;sh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The original Bourne shell. Simple, but limited.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;bash&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Bourne Again Shell – the most widely used and powerful shell on Linux (and the default on RHEL).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;zsh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Z shell – known for features like auto-completion and customization.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ksh&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Korn shell – used in enterprise environments.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;fish&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Friendly interactive shell – user-friendly and great for beginners.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For this tutorial, we will use &lt;strong&gt;&lt;code&gt;bash&lt;/code&gt;&lt;/strong&gt;, as it is the default on &lt;strong&gt;RHEL 9&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;&lt;a id="Real-World Scenario: Shell Scripting"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: Shell Scripting
&lt;/h2&gt;

&lt;p&gt;Let's create and run our first shell script.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open your terminal, create a file and this line into it
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim hello.sh   &lt;span class="c"&gt;# note that script files end with a .sh&lt;/span&gt;

&lt;span class="c"&gt;#!/bin/bash    # this is called shebang /bin/bash must always start the line in every script you are writing&lt;/span&gt;


&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello, world! This is Amanda's first shell script in RHEL 9!"&lt;/span&gt;    &lt;span class="c"&gt;# echo prints the message as an output on your terminal.&lt;/span&gt;

&lt;span class="c"&gt;# Save and exit using:wq!&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%2Fa1z27u8rgud0dzrzyyoo.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%2Fa1z27u8rgud0dzrzyyoo.png" alt="wm1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, give the script permission to run
&lt;/li&gt;
&lt;/ul&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 hello.sh     &lt;span class="c"&gt;# this enables it to be executable&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%2Fobt2e3dkvt2io5tn9evh.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%2Fobt2e3dkvt2io5tn9evh.png" alt="wm3 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify the file has the execute permissions
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-ltr&lt;/span&gt; hello.sh
&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%2F9tb8xkri138unkzhdvbp.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%2F9tb8xkri138unkzhdvbp.png" alt="wm4 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run the script on your terminal
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./hello.sh
&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%2Fk9fm1bzuuqiufui9tn21.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%2Fk9fm1bzuuqiufui9tn21.png" alt="wm5 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Shell scripting might sound scary at first, but once you try it, you will wonder why you didn’t start sooner. Even with just 3 commands, you can automate tasks that make your life easier.&lt;/p&gt;

&lt;p&gt;In RHEL 9, this is one of the most useful beginner skills. Just remember: start simple, run often, and break things (on purpose lol).&lt;/p&gt;

&lt;p&gt;See you in the next article, where we dive deeper into shell scripting!&lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 28!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>redhat</category>
      <category>beginners</category>
      <category>cloudwhistler</category>
      <category>basic</category>
    </item>
    <item>
      <title>Day 26/ 30 Days of Linux Mastery: Storage Management in RHEL 9</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Tue, 20 May 2025 14:52:04 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-26-30-days-of-linux-mastery-storage-management-in-rhel-9-1kml</link>
      <guid>https://forem.com/amandaigwe/day-26-30-days-of-linux-mastery-storage-management-in-rhel-9-1kml</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is Storage Management?&lt;/li&gt;
&lt;li&gt;Core Storage Management Commands&lt;/li&gt;
&lt;li&gt;Real-World Scenario: Storage Management Commands&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 26 of this practical Linux challenge! &lt;/p&gt;

&lt;p&gt;In this post, we will cover &lt;strong&gt;Storage Management&lt;/strong&gt; in RHEL 9, how to handle new storage devices, partition them, format, mount, and make them persistent. &lt;/p&gt;

&lt;p&gt;If you are working with servers or cloud VMs, storage is something you will definitely encounter, whether it is adding more space or organizing existing disks.&lt;/p&gt;




&lt;p&gt;&lt;a id="What is Storage Management?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Storage Management?
&lt;/h2&gt;

&lt;p&gt;Store management comes handy whether you are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Adding an EBS volume on AWS,&lt;/li&gt;
&lt;li&gt;Attaching a new disk to a VM,&lt;/li&gt;
&lt;li&gt;Or just learning how Linux handles storage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You will need to understand how to identify new disks, partition them, format, mount, and persist them in your system.&lt;/p&gt;




&lt;p&gt;&lt;a id="Core Storage Management Commands"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Core Storage Management Commands
&lt;/h2&gt;

&lt;p&gt;More commonly used Core Storage Management Commands options are listed in the table below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Storage Command&lt;/th&gt;
&lt;th&gt;Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;lsblk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists all block devices&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;fdisk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create or manage partitions (for MBR disks)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;parted&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create or manage partitions (especially GPT disks)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mkfs.ext4&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Format partition with ext4 filesystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mkfs.xfs&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Format partition with XFS filesystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mount&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Mount a file system&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;umount&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Unmount a file system&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;blkid&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Displays UUID and type of block devices&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;df -h&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show mounted disk usage in human-readable format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;vi /etc/fstab&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;File to make mounts persistent&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;a id="Real-World Scenario: Storage Management Commands"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: Storage Management Commands
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;You are a Junior Linux SysAdmin and your team adds a new virtual disk &lt;code&gt;/dev/sdb&lt;/code&gt; to your RHEL 9 server. You have been asked to format and mount it to &lt;code&gt;/mnt/backups&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Check Existing Disks
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lsblk 
&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%2F2g84dkclmd1wnwpm3ttu.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%2F2g84dkclmd1wnwpm3ttu.png" alt="bk1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Mine is already partitioned and mounted. but if yours isn't then follow these steps.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Now, create a partition
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;fdisk /dev/sdb      - &lt;span class="c"&gt;# you can do this only using root, add sudo before the command if you are not&lt;/span&gt;

&lt;span class="c"&gt;# type n to create a new partition, accept defaults and w to write changes&lt;/span&gt;

lsblk    - &lt;span class="c"&gt;# to see the new disk created&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Format the Partition
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mkfs.ext4 /dev/sdb1    &lt;span class="c"&gt;# depending on the file extension you want, you do .xfs as well&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;You can go ahead and create the Mount Directory
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;We go on to mount the partition we created earlier
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mount /dev/sdb1 /mnt/backups

&lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt;   - &lt;span class="c"&gt;# to verify it mounted&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Let's make Mount persistent. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;When you manually mount a disk using the mount command, it works only until the system reboots. After a restart, the OS forgets about your mount, and your disk won't be accessible from that mount point anymore.&lt;/p&gt;

&lt;p&gt;So we say that the mount is temporary, not persistent.&lt;/p&gt;

&lt;p&gt;To make sure your disk stays mounted even after a reboot, you need to tell Linux to mount it automatically every time the system starts.&lt;br&gt;
That’s what we mean by making the mount persistent.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;We will first get the UUID of the partition.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;blkid /dev/sdb1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Open the fstab file in a text editor like vim
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;vim /etc/fstab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Scroll down and add this line at the end of the file
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;UUID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;abcd-1234   /mnt/data   ext4   defaults   0   2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;What they mean:&lt;/p&gt;

&lt;p&gt;UUID=abcd-1234: uniquely identifies your disk (this won’t change across reboots)&lt;/p&gt;

&lt;p&gt;/mnt/data: where you want the disk mounted&lt;/p&gt;

&lt;p&gt;ext4: the file system type&lt;/p&gt;

&lt;p&gt;defaults: standard mount options&lt;/p&gt;

&lt;p&gt;0: skip dump (a legacy backup thing)&lt;/p&gt;

&lt;p&gt;2: run fsck (filesystem check) after boot, after root file system&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Test it before rebooting
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;If no errors, it is successful. After this, even if you restart your system, your disk will stay mounted at /mnt/data.&lt;/p&gt;

&lt;p&gt;Before making any changes to /etc/fstab, always back it up. This simple step can save you from system boot issues due to a misconfiguration.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp /etc/fstab /etc/fstab.bak - # to backup

cp /etc/fstab.bak /etc/fstab  - # to restore if system breaks
mount -a  # to remount
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Understanding how Linux handles disks is essential whether you are working with physical servers or managing virtual machines in the cloud.&lt;/p&gt;

&lt;p&gt;Feel free to try it out on your own server or VM.&lt;/p&gt;

&lt;p&gt;See you in the next article!&lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 27!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>redhat</category>
      <category>cloudwhistler</category>
      <category>basic</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Day 25/ 30 Days of Linux Mastery: Disk Management on RHEL 9</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Mon, 19 May 2025 14:25:25 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-25-30-days-of-linux-mastery-disk-management-on-rhel-9-4kn1</link>
      <guid>https://forem.com/amandaigwe/day-25-30-days-of-linux-mastery-disk-management-on-rhel-9-4kn1</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is Disk Management?&lt;/li&gt;
&lt;li&gt;Core Disk Management Commands&lt;/li&gt;
&lt;li&gt;Real-World Scenario: Disk Management Commands&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 25 of this practical Linux challenge! &lt;/p&gt;

&lt;p&gt;Disk running out of space? Don't panic. Today, we dive into &lt;strong&gt;basic disk management&lt;/strong&gt; using simple and practical Linux commands. &lt;/p&gt;

&lt;p&gt;If you have ever seen the dreaded "disk full" error or wondered, &lt;em&gt;"Where did all my space go?"&lt;/em&gt; then today’s lesson is for you.&lt;/p&gt;

&lt;p&gt;As you grow in your journey as a Cloud System Admin or DevOps engineer, being able to know how to &lt;strong&gt;inspect, clean, and manage disk space becomes a **core skill&lt;/strong&gt;. &lt;/p&gt;




&lt;p&gt;&lt;a id="What is Disk Management?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Disk Management?
&lt;/h2&gt;

&lt;p&gt;Disk space issues are one of the &lt;strong&gt;most common problems&lt;/strong&gt; you will face in production environments. Whether it is logs filling up, unused packages, or large files forgotten, knowing how to find and fix space issues keeps your server healthy and running.&lt;/p&gt;

&lt;p&gt;Managing disk space is crucial for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keeping your servers running smoothly&lt;/li&gt;
&lt;li&gt;Avoiding outages due to full volumes&lt;/li&gt;
&lt;li&gt;Debugging space-hungry apps&lt;/li&gt;
&lt;li&gt;Mounting extra storage in cloud environments&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Core Disk Management Commands"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Core Disk Management Commands
&lt;/h2&gt;

&lt;p&gt;More commonly used Core Disk Management Commands options are listed in the table below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Disk Management Command&lt;/th&gt;
&lt;th&gt;What it Does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;df -h&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows available disk space (human-readable)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;du -sh *&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows folder sizes in current directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;lsblk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists block devices like disks and partitions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;mount&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Mounts a filesystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;umount&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Unmounts a mounted filesystem&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;journalctl --disk-usage&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Check journal log size&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;journalctl --vacuum-size=100M&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Clear logs down to a specific size&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;rm -rf &amp;lt;path&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Remove unwanted files/directories (use with caution)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;blkid&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows UUID and type of a block device&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;a id="Real-World Scenario: Disk Management Commands"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: Disk Management Commands
&lt;/h2&gt;

&lt;p&gt;You are running a small RHEL 9 web server, and suddenly you get an alert:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Disk usage at 90%. Clean up space immediately.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s walk through what to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First Check Disk Usage.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-h&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%2F0szwjt56024m788jeciw.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%2F0szwjt56024m788jeciw.png" alt="dc1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now check what's using the disk space
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-sh&lt;/span&gt; /&lt;span class="k"&gt;*&lt;/span&gt;    - &lt;span class="c"&gt;# you can do this only using root, add sudo before the command if you are not&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%2Fjnmr0y96ulfwxi3ai0h0.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%2Fjnmr0y96ulfwxi3ai0h0.png" alt="dc2 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now you have seen what's eating your space you can open that folder
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-sh&lt;/span&gt; /var/&lt;span class="k"&gt;*&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%2F3n87k7bbnu5ofry2dgdh.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%2F3n87k7bbnu5ofry2dgdh.png" alt="dc3 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can go ahead to delete
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &amp;lt;directory path&amp;gt;

&lt;span class="c"&gt;# or clear caches using &lt;/span&gt;

dnf clean all

&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%2Ff09mxs0el6niid24weqp.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%2Ff09mxs0el6niid24weqp.png" alt="dc4 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Disk management is not just for advanced users; even as a beginner on RHEL 9, you can confidently check, manage, and free up space on your system. These small actions make a huge difference in production environments.&lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 26!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>redhat</category>
      <category>cloudwhistler</category>
      <category>beginners</category>
      <category>cloud</category>
    </item>
    <item>
      <title>Day 24/ 30 Days of Linux Mastery: Networking Commands in RHEL 9</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Sat, 17 May 2025 18:27:07 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-24-30-days-of-linux-mastery-networking-commands-in-rhel-9-5g7i</link>
      <guid>https://forem.com/amandaigwe/day-24-30-days-of-linux-mastery-networking-commands-in-rhel-9-5g7i</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is Networking in Linux?&lt;/li&gt;
&lt;li&gt;Core Networking Commands&lt;/li&gt;
&lt;li&gt;Real-World Scenario: Networking Command&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 24 of this practical Linux challenge! Today, we are diving into networking commands.&lt;/p&gt;

&lt;p&gt;Networking is at the heart of everything in Linux, from connecting to the internet, reaching APIs, to managing remote servers.&lt;/p&gt;




&lt;p&gt;&lt;a id="What is Networking in Linux?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Networking in Linux?
&lt;/h2&gt;

&lt;p&gt;Networking in Linux enables systems to communicate with each other over a LAN, WAN, or the internet by configuring interfaces, IP addresses, routes, DNS, and other related settings.&lt;/p&gt;

&lt;p&gt;Imagine you are setting up a cloud server on AWS or managing a VM. You will need to check its IP, confirm connectivity, troubleshoot DNS, or even check which ports are open. These tasks all rely on basic but powerful networking tools.&lt;/p&gt;




&lt;p&gt;&lt;a id="Core Networking Commands "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Core Networking Commands
&lt;/h2&gt;

&lt;p&gt;More commonly used Networking command options are listed in the table below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Networking 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;ip a&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows all IP addresses assigned to interfaces&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ip r&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Displays the routing table&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ping &amp;lt;host&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sends test packets to a host to check connectivity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;nmcli&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manages Network Manager settings (create, modify, check connections)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;nmcli connection show&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;List network connections)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;nmcli device status&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show status of devices&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;nmcli con up &amp;lt;connection-name&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Activate a connection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;curl &amp;lt;URL&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Makes requests to a web server and returns response&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ss -tuln&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Shows open TCP/UDP ports and listening services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hostname&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show system's hostname&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hostnamectl&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Manage system hostname&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hostname -I&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Displays the IP address(es) of your system&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;dig &amp;lt;domain&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fetches DNS information for a domain&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;traceroute &amp;lt;host&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Traces the path packets take to reach a host&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;ifdown&lt;/code&gt; / &lt;code&gt;ifup&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Brings network interfaces down/up (used in some RHEL setups)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;a id="Real-World Scenario: Networking Command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: Networking Command
&lt;/h2&gt;

&lt;p&gt;You just launched your very first RHEL 9 virtual machine (VM) on a cloud platform like AWS, Azure, or GCP. You are supposed to install some packages and set up a web server. But… nothing is loading. You can’t even install updates.&lt;/p&gt;

&lt;p&gt;Let's diagnose the problem.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First check the network interface has an ip address .
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ip a        &lt;span class="c"&gt;# you should see an output like 192.168 .....&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Now check your if you have internet access
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping 8.8.8.8  

&lt;span class="c"&gt;# If this fails then there is no internet. You can also try &lt;/span&gt;

ip r    &lt;span class="c"&gt;# to check the default route&lt;/span&gt;

&lt;span class="c"&gt;# You should see something like "default via 192.168.1.1 dev eth0" if this does not show then you have your answer to the ping failure&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check Status
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nmcli device status     &lt;span class="c"&gt;# checks the status &lt;/span&gt;
nmcli device connect eth0   &lt;span class="c"&gt;# to connect to internet&lt;/span&gt;
ip a   - &lt;span class="c"&gt;# to confirm it has connected and active&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%2Frvlg8a21kpt2ss8zat2d.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%2Frvlg8a21kpt2ss8zat2d.png" alt="n3 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let's test a DNS (Domain name server like Google)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ping google.com

&lt;span class="c"&gt;# always use Ctrl + C to stop the commands from running&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%2F79pzxtovfzoqcgmmofrr.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%2F79pzxtovfzoqcgmmofrr.png" alt="n5 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now test outbound access. If it loads HTML content, your network is up and DNS works!
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl https://www.google.com
&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%2Fznjikm3siuwlfgr33jmk.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%2Fznjikm3siuwlfgr33jmk.png" alt="n6 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Understanding and using networking tools like ip, ping, ss, curl, and nmcli gives you control over your Linux system’s connectivity. You will be able to diagnose problems faster, automate network tasks, and support your team more confidently, especially in cloud environments.&lt;/p&gt;

&lt;p&gt;Keep practicing. And remember: The terminal is your friend.&lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 25!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>cloudwhistler</category>
      <category>basic</category>
      <category>redhat</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day 23/ 30 Days of Linux Mastery: 'tar' Command</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Fri, 16 May 2025 15:09:59 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-23-30-days-of-linux-mastery-tar-command-4f74</link>
      <guid>https://forem.com/amandaigwe/day-23-30-days-of-linux-mastery-tar-command-4f74</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is the &lt;code&gt;tar&lt;/code&gt; Command?&lt;/li&gt;
&lt;li&gt;Core &lt;code&gt;tar&lt;/code&gt; Commands&lt;/li&gt;
&lt;li&gt;Real-World Scenario: &lt;code&gt;tar&lt;/code&gt; Command&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 23 of this practical Linux challenge! Today, we are diving into one of the most useful Linux commands: &lt;strong&gt;&lt;code&gt;tar&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When you think of archiving and backing up files, think of &lt;code&gt;tar&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="What is the  raw `tar` endraw  Command?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the &lt;code&gt;tar&lt;/code&gt; Command?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;tar&lt;/code&gt; stands for &lt;strong&gt;Tape Archive&lt;/strong&gt;. It is a powerful utility used to &lt;strong&gt;create&lt;/strong&gt;, &lt;strong&gt;extract&lt;/strong&gt;, &lt;strong&gt;compress&lt;/strong&gt;, and &lt;strong&gt;archive&lt;/strong&gt; files or directories into a single file, usually with &lt;code&gt;.tar&lt;/code&gt;, &lt;code&gt;.tar.gz&lt;/code&gt;, or &lt;code&gt;.tgz&lt;/code&gt; extensions.&lt;/p&gt;




&lt;p&gt;&lt;a id="Core  raw `tar` endraw  Commands"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Core &lt;code&gt;tar&lt;/code&gt; Commands
&lt;/h2&gt;

&lt;p&gt;More commonly used &lt;code&gt;tar&lt;/code&gt; command options are listed in the table below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
&lt;code&gt;tar&lt;/code&gt; Command&lt;/th&gt;
&lt;th&gt;What It Does&lt;/th&gt;
&lt;th&gt;Explanation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tar -cvf myarchive.tar myfolder/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Creates an archive&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-c&lt;/code&gt; = create, &lt;code&gt;-v&lt;/code&gt; = show progress (verbose), &lt;code&gt;-f&lt;/code&gt; = name the archive file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tar -xvf myarchive.tar&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Extracts an archive&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-x&lt;/code&gt; = extract files from the archive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tar -czvf myarchive.tar.gz myfolder/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Creates a compressed archive using gzip&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-z&lt;/code&gt; = compress with gzip&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tar -xzvf myarchive.tar.gz&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Extracts a &lt;code&gt;.tar.gz&lt;/code&gt; archive&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-x&lt;/code&gt; = extract, &lt;code&gt;-z&lt;/code&gt; = unzip gzip file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tar -tvf myarchive.tar&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lists archive contents&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-t&lt;/code&gt; = list files inside the archive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tar -xvf myarchive.tar file.txt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Extracts a specific file&lt;/td&gt;
&lt;td&gt;Only pulls out &lt;code&gt;file.txt&lt;/code&gt; from the archive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tar -C /target/folder -xvf myarchive.tar&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Extracts to a specific directory&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;-C&lt;/code&gt; = change to target directory before extracting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tar --delete -f myarchive.tar file.txt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Deletes a file from the archive (non-compressed only)&lt;/td&gt;
&lt;td&gt;Removes file.txt from the &lt;code&gt;.tar&lt;/code&gt; file (Does not work on &lt;code&gt;.tar.gz&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;a id="Real-World Scenario:  raw `tar` endraw  Command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: &lt;code&gt;tar&lt;/code&gt; Command
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Select a file you wish to archive. Add &lt;code&gt;.tar&lt;/code&gt; to the filename.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-cvf&lt;/span&gt; demologs.txt.tar
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-lh&lt;/span&gt;   &lt;span class="c"&gt;# to confirm it compressed&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%2Fm8zfnkydrj7yzitj5ajy.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%2Fm8zfnkydrj7yzitj5ajy.png" alt="Image description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify the file is created
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-tvf&lt;/span&gt; demologs.txt.tar 
&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%2Fi0258oqhq26a1dbncldk.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%2Fi0258oqhq26a1dbncldk.png" alt="Image description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restore the tar file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;demoarchives     - &lt;span class="c"&gt;# we create a separate folder to move our archives &lt;/span&gt;

&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xvf&lt;/span&gt; demologs.txt.tar.gz &lt;span class="nt"&gt;-C&lt;/span&gt; demoarchives  - &lt;span class="c"&gt;# restores the .tar to original file format &lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-lh&lt;/span&gt;   &lt;span class="c"&gt;# to confirm both the original and compressed file are there&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%2Ftzq66zovkf1w2zglpoh9.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%2Ftzq66zovkf1w2zglpoh9.png" alt="t4 description" width="800" height="500"&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%2F8yus3covqjqk6iybargd.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%2F8yus3covqjqk6iybargd.png" alt="t5 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;By now, you have seen how to create, extract, compress, and manage archives with &lt;code&gt;tar&lt;/code&gt;. You also understand the most useful options (&lt;code&gt;-c&lt;/code&gt;, &lt;code&gt;-x&lt;/code&gt;, &lt;code&gt;-v&lt;/code&gt;, &lt;code&gt;-f&lt;/code&gt;, &lt;code&gt;-z&lt;/code&gt;, &lt;code&gt;-t&lt;/code&gt;, &lt;code&gt;--delete&lt;/code&gt;) and how to combine them based on what you are trying to achieve.&lt;/p&gt;

&lt;p&gt;Keep experimenting in your terminal. Start by archiving test directories and extracting them to specific locations. The more hands-on you get, the more confident you will become. Stay curious. Stay hands-on.&lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 24!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>redhat</category>
      <category>cloudwhistler</category>
      <category>basic</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Day 22/ 30 Days of Linux Mastery: 'gzip' Command</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Thu, 15 May 2025 15:33:04 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-22-30-days-of-linux-mastery-gzip-command-1ji6</link>
      <guid>https://forem.com/amandaigwe/day-22-30-days-of-linux-mastery-gzip-command-1ji6</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is the &lt;code&gt;gzip&lt;/code&gt; Command?&lt;/li&gt;
&lt;li&gt;Core &lt;code&gt;gzip&lt;/code&gt; Commands&lt;/li&gt;
&lt;li&gt;Real-World Scenario: &lt;code&gt;gzip&lt;/code&gt; Command&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 22 of this practical Linux challenge! Today, we are diving into one of the most useful Linux commands: &lt;strong&gt;&lt;code&gt;gzip&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When you think of compressing any file, think of &lt;code&gt;gzip&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="What is the  raw `gzip` endraw  Command?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the &lt;code&gt;gzip&lt;/code&gt; Command?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;gzip&lt;/code&gt; stands for &lt;strong&gt;GNU zip&lt;/strong&gt;, a tool used to &lt;strong&gt;compress files&lt;/strong&gt;, making them smaller and easier to store or transfer.&lt;/p&gt;




&lt;p&gt;&lt;a id="Core  raw `gzip` endraw  Commands"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Core &lt;code&gt;gzip&lt;/code&gt; Commands
&lt;/h2&gt;

&lt;p&gt;More commonly used &lt;code&gt;gzip&lt;/code&gt; command options are listed in the table below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
&lt;code&gt;gzip&lt;/code&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;gzip filename&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Compress the file (creates &lt;code&gt;filename.gz&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gunzip filename.gz&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Decompress &lt;code&gt;.gz&lt;/code&gt; file back to original&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gzip -k filename&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Compress file &lt;strong&gt;and keep original&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gzip -r folder/&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Recursively compress all files in a folder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gzip -d filename.gz&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Same as &lt;code&gt;gunzip&lt;/code&gt;, decompress file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gzip -v filename&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Verbose mode – shows compression info&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Worthy to note that this command works only for files, not folders.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;a id="Real-World Scenario:  raw `gzip` endraw  Command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: &lt;code&gt;gzip&lt;/code&gt; Command
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Select a file you wish to compress. Compress using the &lt;code&gt;gzip&lt;/code&gt; command. It ends with &lt;code&gt;.gz&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;gzip &lt;/span&gt;demologs.txt

&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-lh&lt;/span&gt;   &lt;span class="c"&gt;# to confirm it compressed&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%2Fwn1lj71xzrwgl1fpwnhw.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%2Fwn1lj71xzrwgl1fpwnhw.png" alt="z1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now you have seen how it works, let's decompress that &lt;code&gt;.gz&lt;/code&gt; file back to the original format.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;gunzip &lt;/span&gt;demologs.txt.gz 
&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%2Fwvml5r2tq8q5a8c8w6kw.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%2Fwvml5r2tq8q5a8c8w6kw.png" alt="z2 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you notice when we compressed, it did not keep the original file. Now, let's keep the original file and the compressed file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;gzip&lt;/span&gt; &lt;span class="nt"&gt;-k&lt;/span&gt; demologs.txt

&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-lh&lt;/span&gt;   &lt;span class="c"&gt;# to confirm both the original and compressed file are there&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%2F2ae8qrzc910on0c4e5wq.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%2F2ae8qrzc910on0c4e5wq.png" alt="z3 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Learning gzip might seem simple, but it is a crucial skill in Linux.&lt;/p&gt;

&lt;p&gt;Mastering it helps you maintain lean storage and improve transfer speeds.&lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 23!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>redhat</category>
      <category>cloudwhistler</category>
      <category>beginners</category>
      <category>bash</category>
    </item>
    <item>
      <title>Day 21/ 30 Days of Linux Mastery: 'diff' Command</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Wed, 14 May 2025 13:35:15 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-21-30-days-of-linux-mastery-diff-command-15cd</link>
      <guid>https://forem.com/amandaigwe/day-21-30-days-of-linux-mastery-diff-command-15cd</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;What is the &lt;code&gt;diff&lt;/code&gt; Command?&lt;/li&gt;
&lt;li&gt;Core &lt;code&gt;diff&lt;/code&gt; Commands&lt;/li&gt;
&lt;li&gt;Real-World Scenario: &lt;code&gt;diff&lt;/code&gt; Command&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to Day 21 of this practical Linux challenge! Today, we are diving into one of the most useful Linux commands: &lt;strong&gt;&lt;code&gt;diff&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Knowing how to &lt;strong&gt;compare files&lt;/strong&gt; is a core skill that shows attention to detail and debugging awareness.&lt;/p&gt;




&lt;p&gt;&lt;a id="What is the  raw `diff` endraw  Command?"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the &lt;code&gt;diff&lt;/code&gt; Command?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;diff&lt;/code&gt; command helps you &lt;strong&gt;compare the contents of two files line by line&lt;/strong&gt;. It’s essential for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verifying configuration changes&lt;/li&gt;
&lt;li&gt;Reviewing file versions&lt;/li&gt;
&lt;li&gt;Debugging or troubleshooting mismatches&lt;/li&gt;
&lt;li&gt;Pre-deployment audits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is especially useful in production environments where systems grow large and messy fast.&lt;/p&gt;




&lt;p&gt;&lt;a id="Core  raw `diff` endraw  Commands"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Core &lt;code&gt;diff&lt;/code&gt; Commands
&lt;/h2&gt;

&lt;p&gt;Basic Syntax for &lt;code&gt;diff&lt;/code&gt; is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;diff &lt;span class="o"&gt;[&lt;/span&gt;options] file1 file2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More commonly used diff commands options are listed in the table below.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;
&lt;code&gt;diff&lt;/code&gt; Options&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;-y&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Displays output side by side&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-c&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Produces a context diff (shows surrounding lines)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-u&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Unified diff format (commonly used for patches)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--color&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds color to differences in output&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-r&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Recursively compares directories&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--suppress-common-lines&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Used with &lt;code&gt;-y&lt;/code&gt;, hides lines that are the same&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;a id="Real-World Scenario:  raw `diff` endraw  Command"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Scenario: &lt;code&gt;diff&lt;/code&gt; Command
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;We will create a file, then copy it as a backup and modify it by adding more words inside. &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%2Frlcg0mxzdjn3e4d08fr2.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%2Frlcg0mxzdjn3e4d08fr2.png" alt="d1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Compare the files using &lt;code&gt;diff&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;diff demologs.txt demologsbackup.txt
&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%2Fzm9vm9cgomm4621dgwk9.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%2Fzm9vm9cgomm4621dgwk9.png" alt="d2 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let's use side-by-side comparison to view the files easily
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;diff &lt;span class="nt"&gt;-y&lt;/span&gt; demologs.txt demologsbackup.txt
&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%2Fi68inw8uppsj3otswr4j.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%2Fi68inw8uppsj3otswr4j.png" alt="d3 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;you can see the last line that was included.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Use Unified Format for Patching
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;diff &lt;span class="nt"&gt;-u&lt;/span&gt; demologs.txt demologsbackup.txt &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; patch.diff
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;This creates a .diff file that can be used to patch another demolog file using patch. Shows you the modification and versions of both files.&lt;/p&gt;
&lt;/blockquote&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%2Fw06mq8unj8vcxckpvano.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%2Fw06mq8unj8vcxckpvano.png" alt="d4 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Whenever you need to check a file and compare with older versions to see changes or modifications, always think of using the &lt;code&gt;diff&lt;/code&gt; command! &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;diff&lt;/code&gt; command is not flashy, but it is one of those must-know tools that gets real work done. Whether you are reviewing configs, debugging a deployment, or managing drift in production, &lt;code&gt;diff&lt;/code&gt; helps you stay in control.&lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 22!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>redhat</category>
      <category>cloudwhistler</category>
      <category>beginners</category>
      <category>bash</category>
    </item>
    <item>
      <title>Day 20/ 30 Days of Linux Mastery: Recover/Rescue Root Password in RHEL9</title>
      <dc:creator>Amanda Igwe</dc:creator>
      <pubDate>Tue, 13 May 2025 13:51:13 +0000</pubDate>
      <link>https://forem.com/amandaigwe/day-20-30-days-of-linux-mastery-recoverrescue-root-password-in-rhel9-111b</link>
      <guid>https://forem.com/amandaigwe/day-20-30-days-of-linux-mastery-recoverrescue-root-password-in-rhel9-111b</guid>
      <description>&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;Step-by-Step Guide on Recovering the Root Password&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;li&gt;Let's Connect&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a id="Introduction"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Welcome back to day 20!. Today’s focus is on how to recover or rescue the forgotten root password in RHEL 9.&lt;/p&gt;

&lt;p&gt;Yes, it happens that one might wake up one day and you can no longer remember your system root password. So, what do you do as the Linux System Administrator?&lt;/p&gt;

&lt;p&gt;Let’s get into it!&lt;/p&gt;




&lt;p&gt;&lt;a id="Step-by-Step Guide on Recovering the Root Password"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step-by-Step Guide on Recovering the Root Password
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Start your virtual machine (I am using VirtualBox) or type reboot in your console.&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%2Fbjbahhem32owl9gr6qg6.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%2Fbjbahhem32owl9gr6qg6.png" alt="r1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once it is about to boot, quickly use the up and down arrow keys to select the option with 'rescue' in it. &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%2Flie0udgfi3ul42rls6ad.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%2Flie0udgfi3ul42rls6ad.png" alt="b1 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Hit the letter 'e' on your keyboard quickly on the GRUB boot entry screen to enter edit mode. (This is for editing the parameters)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Look for the line starting with &lt;code&gt;linux&lt;/code&gt; or &lt;code&gt;linux16&lt;/code&gt;. Now, at the end of that line, add the following inside.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rd.break console=tty1 selinux=0

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;With this we do not need to do the 'touch /.autorelabel' that is creating the autorelabel file in the root directory anymore.&lt;/p&gt;
&lt;/blockquote&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%2Ffu0oopcj9pzueqkp3bsj.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%2Ffu0oopcj9pzueqkp3bsj.png" alt="b2 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click Ctrl+X to start (Press Enter for maintenance if prompted, to see the shell)&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%2F04v56wzk4hitsur2nyfb.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%2F04v56wzk4hitsur2nyfb.png" alt="b4 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now you on the shell, you need to remount and give it read/write mode. Type this prompt
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mount -o remount,rw /sysroot    - # press enter
chroot /sysroot               - # The root we want to reset password for. Now press enter.

passwd    -                # Type this and press Enter, you will be prompted to enter the new password and retype it again to confirm it.

&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%2F9lll8uwqbspajsgpx3uq.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%2F9lll8uwqbspajsgpx3uq.png" alt="b5 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now type exit &lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type exit again&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The system will boot and request you to login. Now login as the root and the new password. &lt;/p&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%2Fq3t9wu5k3d08nggt5dd3.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%2Fq3t9wu5k3d08nggt5dd3.png" alt="b7 description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it! We have successfully recovered our root password. No more panics!&lt;/p&gt;




&lt;p&gt;&lt;a id="Conclusion"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Recovering root password is a must-know skill and very important for every Cloud, Linux or DevOps Engineer. &lt;/p&gt;

&lt;p&gt;If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 21!&lt;/p&gt;




&lt;p&gt;&lt;a id="Let's Connect!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's Connect!
&lt;/h2&gt;

&lt;p&gt;If you want to connect or share your journey, feel free to reach out on &lt;strong&gt;&lt;em&gt;&lt;a href="https://www.linkedin.com/in/amandaigwe" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;. &lt;br&gt;
I am always happy to learn and build with others in the tech space.&lt;/p&gt;

&lt;p&gt;#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer&lt;/p&gt;

</description>
      <category>redhat</category>
      <category>beginners</category>
      <category>cloudwhistler</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
