<?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>DEV Community: habdulr1</title>
    <description>The latest articles on DEV Community by habdulr1 (@habdulr1).</description>
    <link>https://dev.to/habdulr1</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%2F2210184%2Fa4a837ea-32b6-47b0-8ebc-c9d445e2135e.png</url>
      <title>DEV Community: habdulr1</title>
      <link>https://dev.to/habdulr1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/habdulr1"/>
    <language>en</language>
    <item>
      <title>IPs Explained: The Address of the Internet</title>
      <dc:creator>habdulr1</dc:creator>
      <pubDate>Wed, 01 Jan 2025 09:32:08 +0000</pubDate>
      <link>https://dev.to/habdulr1/ips-explained-the-address-of-the-internet-5pc</link>
      <guid>https://dev.to/habdulr1/ips-explained-the-address-of-the-internet-5pc</guid>
      <description>&lt;p&gt;&lt;strong&gt;Understanding IP Addresses: A Simple Guide for Everyone&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the digital age, where we rely heavily on the internet for communication, work, and entertainment, an IP address is often overlooked yet fundamental. An IP address, or Internet Protocol address, is a unique identifier assigned to each device connected to the internet, enabling them to communicate with one another.&lt;/p&gt;

&lt;p&gt;An IP address (Internet Protocol address) is like the address for your house—but for your device on a network or the internet. It’s a unique set of numbers that identifies your device (be it your laptop, PC, mobile, smart TV or any other device) so it can send and receive data, just like a postal address tells mail where to go.&lt;/p&gt;

&lt;p&gt;Think of it like this:&lt;/p&gt;

&lt;p&gt;Your home address tells the post office where to deliver packages.&lt;br&gt;
An IP address tells the internet where to deliver websites, videos, or emails to your device (packets of data).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Does an IP Address Look Like?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An IP address is usually written as a series of numbers separated by dots. For example:&lt;/p&gt;

&lt;p&gt;192.168.1.1 (a common private IP)&lt;br&gt;
8.8.8.8 (a public IP used by Google)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;IPv4 versus IPv6 Addresses&lt;/strong&gt;&lt;br&gt;
There are two primary types of IP addresses: IPv4 and IPv6. IPv4 addresses consist of four sets of numbers, ranging from 0 to 255, separated by periods like seen above. An example is &lt;strong&gt;113.178.10.11&lt;/strong&gt;. Due to the growing number of devices accessing the internet, IPv6 was introduced, featuring a more complex structure that allows for a much larger pool of addresses. This format is expressed in eight groups of hexadecimal numbers, such as &lt;strong&gt;2001:0db8:85a3:0000:0000:8a2e:0370:7334&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In the early days of the Internet, the number of connected devices was relatively small. Engineers designed the IPv4 protocol to accommodate this modest scale. They devised a system called Class-Based IP Addressing, dividing the IP space into five classes. Class A, B, C, D &amp;amp; E. based on the number of devices each network needed to support. These classes are primarily defined by the leading bits and determine the size of the network and host portions of the address. Here's a breakdown of the classes:&lt;br&gt;
&lt;iframe class="tweet-embed" id="tweet-1874333965756358729-63" src="https://platform.twitter.com/embed/Tweet.html?id=1874333965756358729"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1874333965756358729-63');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1874333965756358729&amp;amp;theme=dark"
  }



&lt;br&gt;
Here’s a quick analogy to understand these classes:&lt;/p&gt;

&lt;p&gt;Class A: The mansions of IP addresses, with room for millions of devices in a single network. Ideal for large organizations.&lt;/p&gt;

&lt;p&gt;Class B: The mid-sized apartments, capable of hosting thousands of devices.&lt;/p&gt;

&lt;p&gt;Class C: The cozy cottages, perfect for small networks with fewer devices.&lt;/p&gt;

&lt;p&gt;Class D &amp;amp; E: Reserved for experimental and multicast uses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are Leading Bits?&lt;/strong&gt;&lt;br&gt;
Leading bits are the first few bits in the binary representation of an IPv4 address. These bits are used to classify the address into one of the five address classes (A, B, C, D, or E). They define the structure of the IP address, particularly how the network portion and the host portion are divided.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Leading Bits Determine Network and Host Portions?&lt;/strong&gt;&lt;br&gt;
IPv4 addresses are 32 bits long. The address is divided into two parts:&lt;br&gt;
&lt;strong&gt;Network Portion:&lt;/strong&gt; Identifies the network (shared by all devices in that network).&lt;br&gt;
&lt;strong&gt;Host Portion:&lt;/strong&gt; Identifies the specific device (host) within the network.&lt;br&gt;
The number of leading bits used for the network portion determines how many bits are left for the host portion. The fewer bits used for the network portion, the more bits are available for hosts, and vice versa.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Class&lt;/th&gt;
&lt;th&gt;Leading Bits&lt;/th&gt;
&lt;th&gt;Network Bits&lt;/th&gt;
&lt;th&gt;Host Bits&lt;/th&gt;
&lt;th&gt;Max Hosts per Network&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;8 bits&lt;/td&gt;
&lt;td&gt;24 bits&lt;/td&gt;
&lt;td&gt;~16 million (2³¹ - 2 usable)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;B&lt;/td&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;16 bits&lt;/td&gt;
&lt;td&gt;16 bits&lt;/td&gt;
&lt;td&gt;~65,536 (2¹⁶ - 2 usable)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;C&lt;/td&gt;
&lt;td&gt;110&lt;/td&gt;
&lt;td&gt;24 bits&lt;/td&gt;
&lt;td&gt;8 bits&lt;/td&gt;
&lt;td&gt;~254 (2⁸ - 2 usable)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;D&lt;/td&gt;
&lt;td&gt;1110&lt;/td&gt;
&lt;td&gt;Multicast&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;Used for multicasting, not hosts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;E&lt;/td&gt;
&lt;td&gt;1111&lt;/td&gt;
&lt;td&gt;Experimental&lt;/td&gt;
&lt;td&gt;N/A&lt;/td&gt;
&lt;td&gt;Reserved for experimental use&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Practical Example&lt;/strong&gt;&lt;br&gt;
Let’s take the IPv4 address 192.168.1.1:&lt;/p&gt;

&lt;p&gt;Binary form: 11000000.10101000.00000001.00000001.&lt;br&gt;
Leading bits: 110 (Class C).&lt;br&gt;
Network portion: First 24 bits (192.168.1).&lt;br&gt;
Host portion: Last 8 bits (1).&lt;br&gt;
This means 192.168.1.1 belongs to a Class C network, where the network part is 192.168.1, and the device within this network is 1.&lt;/p&gt;

&lt;p&gt;In summary, IP addresses play a crucial role in ensuring that our devices can communicate effectively online. By grasping the basics of what an IP address is and how it operates, we can gain a clearer understanding of the interconnected world we navigate daily. I will cover about classless IP addresses using CIDR range in the next post.&lt;/p&gt;

</description>
      <category>networking</category>
      <category>devops</category>
      <category>systemdesign</category>
      <category>vpc</category>
    </item>
    <item>
      <title>Basic AWS Elastic Load Balancer Setup</title>
      <dc:creator>habdulr1</dc:creator>
      <pubDate>Wed, 20 Nov 2024 08:20:16 +0000</pubDate>
      <link>https://dev.to/habdulr1/basic-aws-elastic-load-balancer-setup-4k8n</link>
      <guid>https://dev.to/habdulr1/basic-aws-elastic-load-balancer-setup-4k8n</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is a load balancer?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine a busy intersection with no traffic signal or traffic cop. If nobody controls the traffic, the junction will be loaded with vehicles, causing traffic jams, delays in reaching the destination, and even accidents. Similarly, if many users are trying to access a server(or servers) simultaneously it can cause congestion in the network, delay in data transmission, and even crash the server.&lt;/p&gt;

&lt;p&gt;A load balancer acts as a traffic cop for websites and applications. It distributes incoming network or application traffic across multiple servers to ensure no single server is overwhelmed. It improves application reliability and scalability&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%2Fnps6188kznj55zbru7la.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%2Fnps6188kznj55zbru7la.png" alt="How load balancer works" width="800" height="564"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key features of a load balancer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Load balancers are very important for modern web applications, applications that work on microservices architecture, for content delivery, disaster recovery etc. Some important features of load balancers are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Traffic Distribution:&lt;/strong&gt; routes requests to different servers based on algorithms like round-robin, least connection, etc. so that no server is overburdened.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health Monitoring:&lt;/strong&gt; checks the availability and performance of the servers continuously and redirects traffic away from unresponsive or unhealthy servers, so that the applications are highly available&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fault Tolerance:&lt;/strong&gt; provides redundancy by redistributing traffic to healthy servers if a server fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability:&lt;/strong&gt; allows applications to add or remove servers dynamically based on user demand without disrupting services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSL Offloading:&lt;/strong&gt; handles SSL/TLS encryption and decryption, reducing the load on backend servers. Load balancers are used for the implementation of security policies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Session Persistence:&lt;/strong&gt; allows specific users maintain a consistent connection with the same server for specific tasks.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In short, a load balancer acts as the first point of contact for incoming traffic, ensuring high availability, performance, and fault tolerance for web applications and services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Load Balancers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Load balancers can be categorized to different types depending on their use cases. On a broader classification, we can divide load balancers into three different categories based on how they are deployed.&lt;br&gt;
&lt;strong&gt;1. Hardware load balancers&lt;/strong&gt; - Dedicated physical appliances designed for high-performance traffic distribution. They are often used by large scale enterprises and data centers that require minimum latency and high reliability. They are also very expensive. Some examples are &lt;br&gt;
&lt;strong&gt;2. Software load balancers&lt;/strong&gt; - These are software solutions running on commodity hardware or virtual machines. They are cost-effective and customizable for on-premise or containerized environments. Some examples are Nginx, HAProxy, Apache HTTP Server&lt;br&gt;
&lt;strong&gt;3. Cloud load balancers&lt;/strong&gt; - They are fully managed services provided by cloud providers for scalable and dynamic workloads. Often used by application hosted on the cloud platforms that has fluctuating traffic. Examples are &lt;a href="https://aws.amazon.com/elasticloadbalancing/" rel="noopener noreferrer"&gt;AWS Elastic Load Balancer (ELB)&lt;/a&gt;, Azure Load Balancer, Google Cloud Load Balancer.&lt;/p&gt;

&lt;p&gt;Now let's set up an AWS Elastic Load Balancer. There are Application Load Balancer, Network Load Balancer, and Gateway Load Balancer under AWS's elastic load balancing services under Version 2. Version 1 has Classic Load Balancer. We will set up an Application Load Balancer. &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%2F9vw7vlskh1fft3m49bzz.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%2F9vw7vlskh1fft3m49bzz.png" alt="AWS ELB documentation" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the official documentation of &lt;a href="https://docs.aws.amazon.com/elasticloadbalancing/" rel="noopener noreferrer"&gt;Elastic Load Balancing&lt;/a&gt;, we can see the definition of ELB as Elastic Load Balancing automatically distributes your incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones. It monitors the health of its registered targets and routes traffic only to the healthy targets. You can select the type of load balancer that best suits your needs.&lt;/p&gt;

&lt;p&gt;For this demo, we will create 3 VMs using &lt;a href="https://docs.aws.amazon.com/ec2/" rel="noopener noreferrer"&gt;AWS EC2 Service&lt;/a&gt;. These are basically our web servers. Login to your AWS Console, Goto EC2 dashboard and click on Launch Instances.&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%2Fdaq06kv9me2f4kvjhfbk.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%2Fdaq06kv9me2f4kvjhfbk.png" alt="EC2 Dashboard" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change the number of instances to 3, give the instance a name. I have given as Web-01, for the second and third instances the names will be changed to Web-02 and Web-03 once they are up and running. I have chosen Amazon Linux as the AMI which is the OS of our webserver and the instance type as t2.micro which is eligible for free-tier.&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%2Ff3ctpv9acc7jl6jzlw7g.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%2Ff3ctpv9acc7jl6jzlw7g.png" alt="EC2 creation" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the keypair to access your VM from your laptop. Create a new key pair if you don't have any. Also select the security group for the VMs or create a new one if you want. I chose the default 8gb storage and launched the instances.&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%2F8492bl4ne8dmmmmezckd.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%2F8492bl4ne8dmmmmezckd.png" alt="ec2 keypair and sg" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the security group make sure you have opened ports 80 and 443 (HTTP and HTTPS) to be accessible from all IPs by editing the inbound rules.&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%2Fwo9zxi2bcjumu97uihr9.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%2Fwo9zxi2bcjumu97uihr9.png" alt="security group" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, go to the EC2 dashboard, and click on instances. I have my web servers up and running and I have renamed the other 2 web servers as Web-02 and Web-03 by hovering on the name and clicking on the pencil icon&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%2Fungeb77k5m6lotdvgzli.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%2Fungeb77k5m6lotdvgzli.png" alt="EC2 dashboard" width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the instance ID to get the details of the server like IP addresses and more.&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%2F0iv2qgf1w2bs1h2n6iyq.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%2F0iv2qgf1w2bs1h2n6iyq.png" alt="Instance details" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's connect to the instances and install httpd in our web servers. I am using &lt;a href="https://mobaxterm.mobatek.net/download.html" rel="noopener noreferrer"&gt;MobaXterm&lt;/a&gt; to connect to my instances. Copy the IPs of the webservers and connect to them individually using the .pem key-pair file. Default username for RedHat based distributions in AWS is ec2-user&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%2F6qjmm79j3uup7oz0yc43.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%2F6qjmm79j3uup7oz0yc43.png" alt="mobaxterm" width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have connected to all three webservers in MobaXterm. MobaXterm has a beautiful feature 'Multi Exec' which allows us to execute the same commands in all the terminals at the same time. &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%2F0znecrjyotkz284enr6e.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%2F0znecrjyotkz284enr6e.png" alt="Multi Exec" width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's install httpd in all the systems, start the service and enable it. The following commands can be used for the same. Make sure to copy each line separately.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
&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%2Fzbfw1n9350gygd1juyu7.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%2Fzbfw1n9350gygd1juyu7.png" alt="httpd" width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;httpd service is now up and running. Let's check it out by copy pasting the IP addresses of our web servers in our browser.&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%2Furaw3aog5egteakfmyvg.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%2Furaw3aog5egteakfmyvg.png" alt="It works" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voila! It works on all three webservers. Now let's create an index.html in &lt;code&gt;/var/www/html&lt;/code&gt; folder in all the three webservers &lt;code&gt;sudo vi /var/www/html/index.html&lt;/code&gt;&lt;br&gt;
 and write the following content to it.&lt;br&gt;
&lt;code&gt;&amp;lt;h2&amp;gt;My website! Served from Web Server 01&amp;lt;/h2&amp;gt;&lt;/code&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%2Frme2e89po8loz8o2toin.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%2Frme2e89po8loz8o2toin.png" alt="index.html" width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change the content of index.html in web02 and web03 Web Server 02 and Web Server 03 respectively and restart httpd service. &lt;code&gt;sudo systemctl restart httpd&lt;/code&gt; and refresh the browser windows. &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%2Fnnpv1l6rm5hzc7dkrfeo.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%2Fnnpv1l6rm5hzc7dkrfeo.png" alt="Websites" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's create our target group in EC2 dashboard. Target groups are nothing but a group of instances, IP addresses, lamba functions, or application load balancers. In our case, the target group is the group of webservers we have created. Goto Target Groups under Load Balancing in the left pane of our console and click on Create Target Groups&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%2Fr290x5ys2qug77r79xju.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%2Fr290x5ys2qug77r79xju.png" alt="Target groups" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose the target group as instances and give the target group a name. Under advanced health checks, it is optional to change the healthy threshold, unhealthy threshold, timeout and interval values. Click Next, select all three instances, click on Include as pending below, and then click on Create Target Group at the bottom.&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%2F6rje0frrscmd6k7ziij1.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%2F6rje0frrscmd6k7ziij1.png" alt="Create Target group" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that our target group is ready, let us create the load balancer. Goto Load Balancers under Load Balancing in the left pane and click on Create load balancer.&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%2F6eovtx6s9lhvk6h1ucrd.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%2F6eovtx6s9lhvk6h1ucrd.png" alt="create lb" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the next screen, we have the option to choose the type of load balancer we want to create. We are creating an application load balancer. Click on the Create button under the Application Load Balancer. Give the load balancer a name&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%2F0tttos8vhq2my5l3ccva.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%2F0tttos8vhq2my5l3ccva.png" alt="LB config" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select 2 or more availability zones under Network Mapping settings to ensure high availability&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%2Fmp69qb6xeg77hccrkl0h.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%2Fmp69qb6xeg77hccrkl0h.png" alt="Mapping" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the security group for the load balancer. It is ideal to create a separate security group for the load balancer, by clicking on Create Security group. For the time being, I have selected the same security group with which I have created the instances. Make sure to open port 80 in the SG if you have created a new one.&lt;br&gt;
Under Listeners and routing select the target group that we have created. In this case webservers-tg. Click on Create load balancer button at the bottom&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%2Ftrhphtcphjcgqdftq8wn.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%2Ftrhphtcphjcgqdftq8wn.png" alt="LB" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Wait for a few minutes for the load balancer to get provisioned. After some time we can see that the load balancer is Active&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%2F8ntizj6cvg3nqcp03ga5.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%2F8ntizj6cvg3nqcp03ga5.png" alt="lb active" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's copy the DNS name and paste it into our browser's address bar. The magic of load balancer has begun. I got the response from Web Sever 02&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%2Fuhungjx9y701r3a4s7h9.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%2Fuhungjx9y701r3a4s7h9.png" alt="webserver02 response" width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now if I refresh the browser window, let us see what happens&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%2Fjfevkkpellos8ven2172.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%2Fjfevkkpellos8ven2172.png" alt="webserver03" width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See, now the response is from Web Sever 03 even though our DNS name is the same. Now if we keep refreshing &lt;br&gt;
we can see the response from Web Server 01 also.&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%2F8x4sgqoj4q8ccne29v5q.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%2F8x4sgqoj4q8ccne29v5q.png" alt="Webserver 01" width="800" height="474"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is how intelligently AWS Elastic Load Balancer intelligently routes the client requests to backend servers without burdening a single server. &lt;br&gt;
Load Balancers serve multiple purposes as mentioned above like high availability, fault tolerance, scalability etc. &lt;br&gt;
This tutorial was intended to give a brief introduction to load balancers and how they work in the backend. Play around with the instances. Stop httpd on any of the servers and see how the target goes to unhealthy state automatically in the background. ELB is capable of much more than just traffic distribution. &lt;/p&gt;

&lt;p&gt;Once you are done with the practice make sure to delete the load balancer, target groups, and instances to avoid unnecessary billing. &lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Linux File System</title>
      <dc:creator>habdulr1</dc:creator>
      <pubDate>Mon, 11 Nov 2024 17:10:30 +0000</pubDate>
      <link>https://dev.to/habdulr1/linux-file-system-8ca</link>
      <guid>https://dev.to/habdulr1/linux-file-system-8ca</guid>
      <description>&lt;p&gt;&lt;strong&gt;Linux Vs Windows File System&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Linux file system is a hierarchical tree structure. We have the root folder just like a tree root and inside the root folder we have different folders which has it's own purpose and inside those folders, we have other folders and files.&lt;br&gt;
In comparison the Windows file system does not have one root folder where all folders extend from, rather it has multiple root folders. We have disks or drives as root folders. Earlier in the era of insertable disks like floppy disks or CDs windows used letters to assign drives for each insertable disks. Eg: A and B were removable disks. When HDDs were added to PCs, the letter C became the letter for the internal disk or hard drive and after that all additional disks were given the next available letters and it has stayed the same until now. That's how the file system is different from that of Linux&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linux file system overview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Graphical User Interface (GUI) always has this graphical file system view. The file-explorer program shows us the folders and files in a graphical representation that we can navigate easily.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdygbe8p1c4vcnu6mox5a.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%2Fdygbe8p1c4vcnu6mox5a.png" alt="FileexploreInGUI" width="800" height="473"&gt;&lt;/a&gt;&lt;br&gt;
When you click on the file explorer application on the left pane, it opens up the home directory by default. Every user on Linux gets their own space inside the home directory. There will be some default directories created along with the home directory like Documents, Downloads, Music, etc. The home directory is actually one of the folders in the root of the file system. &lt;br&gt;
How can you see the root folder and other directories? &lt;br&gt;
Well if you click on + Other Locations, we can get there&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpbyxh71tjb2bgi5o00wm.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%2Fpbyxh71tjb2bgi5o00wm.png" alt="LinuxFS" width="800" height="231"&gt;&lt;/a&gt;&lt;br&gt;
Now I am inside the root directory. Inside the root directory, we can see the home directory. This is basically where all Linux users' personal space is created. Each user has their own space in the home directory except for the root user which actually has its own isolated folders separated from all other users. The folder named &lt;code&gt;/root&lt;/code&gt; is the home directory of the root user and &lt;code&gt;/home&lt;/code&gt; directory is the home directory for all other users.&lt;br&gt;
If you open the home directory you can see the user's home directory &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp79o4s9kqmvm74wrdysh.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%2Fp79o4s9kqmvm74wrdysh.png" alt="HomeDirectory" width="800" height="250"&gt;&lt;/a&gt;&lt;br&gt;
In my case, the Linux user is osboxes and if you double-click osboxes it will take you back to the first screenshot.&lt;br&gt;
It is important to isolate users and their personal space to keep their programs, configurations, editors, and so on private for each user. Meanwhile, there are some programs that are installed systemwide. This means these programs are available for all users on that computer. They are available outside the home directory. These can be applications or linux commands that are available for the system and all other users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/bin&lt;/strong&gt;&lt;br&gt;
bin stands for binaries. &lt;code&gt;/bin&lt;/code&gt; folder inside the root directory contains the executables for most essential user commands. some examples of the files inside the &lt;code&gt;/bin&lt;/code&gt; folder include commands like cat, cp, calendar, echo, etc. Most of the basic Linux commands can be found here&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsr0p72wminxlnxr9ldaz.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%2Fsr0p72wminxlnxr9ldaz.png" alt="bindirectory" width="800" height="473"&gt;&lt;/a&gt;&lt;br&gt;
What is a binary?&lt;br&gt;
Binary is a computer-readable format that the computer understands. Instead of a text, it is a combination of 1s and 0s. The executables must be in binary for the computer to understand. This is why all these commands are in the bin folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/sbin&lt;/strong&gt;&lt;br&gt;
sbin are also binaries but system binaries. These commands are system-relevant. These commands need a super user permission to execute them. Examples of these commands are adduser, passed, chpasswd, iptables for network configuration, etc. All these commands need super user privilege which normal users don't have. These commands are mostly used by system administrators to administer the system and also by the system itself.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjullch8tijk76hkk4vbm.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%2Fjullch8tijk76hkk4vbm.png" alt="sbindirectory" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/lib&lt;/strong&gt;&lt;br&gt;
Lib stands for libraries. This directory contains essential shared libraries that executables from &lt;code&gt;/bin&lt;/code&gt; or &lt;code&gt;/sbin&lt;/code&gt; use. If the commands in bin or sbin need any libraries to access, they are fetched from this directory. So we can understand that one single program can be split into different locations like having executables in &lt;code&gt;/bin&lt;/code&gt; directory and libraries in &lt;code&gt;/lib&lt;/code&gt; directory which is a common way of splitting location of program when you install them in Linux&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzmtky1r0k28zrcnz73pr.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%2Fzmtky1r0k28zrcnz73pr.png" alt="libdirectory" width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/usr&lt;/strong&gt;&lt;br&gt;
usr stands for user. Originally this was used as the user directory before home directory came into the picture. If we look inside the &lt;code&gt;/usr&lt;/code&gt; directory we see a bunch of folders. We have &lt;code&gt;/bin&lt;/code&gt;,&lt;code&gt;/sbin&lt;/code&gt;,&lt;code&gt;/lib&lt;/code&gt; folders just like we have in the root directory at user level. The same commands we see in the root folders binary folders can be seen inside the usr directory as well. It is because there is a historical reason. As the UNIX system design had storage limitations in the older days, it was split to root binary folders and user binary folders. The duplication doesn't make sense in modern era of storage solutions. However, the concept remains from the old times. Also whenever we execute common Linux commands they are executed from the user's bin folder.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frq79m3e14qndes6lb1pw.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%2Frq79m3e14qndes6lb1pw.png" alt="usrdirectory" width="800" height="235"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/usr/local/&lt;/strong&gt;&lt;br&gt;
Inside &lt;code&gt;/usr/local&lt;/code&gt; folder we can again see bin, sbin and lib directories. Here the differentiation is pretty clear. This is where third party applications that YOU as linux user install on the computer goes. Applications like docker, minikube, java, etc will go here. &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Futni4erw29eybjjzsx5v.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%2Futni4erw29eybjjzsx5v.png" alt="usrlocaldirectory" width="800" height="229"&gt;&lt;/a&gt;&lt;br&gt;
Note again that the &lt;code&gt;/usr&lt;/code&gt; folder is inside the root. So everything that is installed in the local folder will be available for all users on the computer. It is a systemwide installation. For eg: if you install docker in &lt;code&gt;/usr/local&lt;/code&gt; every user in the system can access docker. However, in linux it is possible to install applications specific to users' by installing it in the user's home directory&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/opt&lt;/strong&gt;&lt;br&gt;
This is another location where some third-party programs that you install will be placed.&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%2Flum82ch6lre1ql07ld3l.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%2Flum82ch6lre1ql07ld3l.png" alt="optdirectory" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So what's the difference between &lt;code&gt;/usr/local&lt;/code&gt; and &lt;code&gt;/opt&lt;/code&gt;?&lt;br&gt;
There are some apps that do not split their code or files into different directories like having binaries and libraries in different folders. They have all the binaries and libraries in the same folder. Examples of such applications are most of the IDEs (code editors). They will be usually installed under &lt;code&gt;/opt&lt;/code&gt; where everything is under one folder &lt;br&gt;
These applications are also available systemwide for all users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/boot&lt;/strong&gt;&lt;br&gt;
This directory contains the files for booting the system. You need to be careful handling this directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/etc&lt;/strong&gt;&lt;br&gt;
This is the directory where most of the system configuration files are stored. Configuration files like network configuration, linux user data, passwords. This directory stores the configuration for system-wide applications. These files are not read-only. They are writable also. &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqc75bh1s50pvxcwasdjb.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%2Fqc75bh1s50pvxcwasdjb.png" alt="etc" width="800" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/dev&lt;/strong&gt;&lt;br&gt;
dev stands for devices. This is the location of device files like keyboard, mouse, hard disk, webcam, etc. Applications regarding the hardware connected to your computer will be placed in this directory&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fftwjs7x5su5ilh8ltemz.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%2Fftwjs7x5su5ilh8ltemz.png" alt="dev" width="800" height="473"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/var&lt;/strong&gt;&lt;br&gt;
When the operating system starts, it actually logs some data. And these logs are stored in a folder inside &lt;code&gt;/var&lt;/code&gt; called &lt;code&gt;/var/log&lt;/code&gt;. It also contains &lt;code&gt;/var/cache&lt;/code&gt; directory which contains cached data from applications. Basically &lt;code&gt;/var&lt;/code&gt; folder contains logs from different processes and applications that are running on your computer&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnkufo3rppgswffgx9v85.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%2Fnkufo3rppgswffgx9v85.png" alt="var" width="800" height="244"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/tmp&lt;/strong&gt;&lt;br&gt;
We also have a temporary folder where temporary resources required for some processes are kept here temporarily. At some point, they will be deleted usually at system reboots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;/media and /mnt&lt;/strong&gt;&lt;br&gt;
Media is basically where your external media is mounted. It contains subdirectories, where removable media devices inserted into the computer are mounted.&lt;br&gt;
Example external hard drive, network drive, USB drives, etc. They will also be referenced in the &lt;code&gt;/dev&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;For manually mounting for eg: file systems to your OS you have this &lt;code&gt;/mnt&lt;/code&gt; folder. &lt;/p&gt;

&lt;p&gt;Usually we are not interacting with these folders directly. Most of the time these are automatically dealt by the package managers. &lt;br&gt;
But when you are debugging or troubleshooting it is good to know where the files are located. I have used ubuntu 22.04 to demonstrate the file structure. &lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>architecture</category>
      <category>ubuntu</category>
    </item>
  </channel>
</rss>
