<?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: TUNDE OGUNMODEDE</title>
    <description>The latest articles on DEV Community by TUNDE OGUNMODEDE (@tunde-dev).</description>
    <link>https://dev.to/tunde-dev</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4141756%2F2e15a2a3-43c3-4548-a9ad-f74f41f70237.jpg</url>
      <title>DEV Community: TUNDE OGUNMODEDE</title>
      <link>https://dev.to/tunde-dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tunde-dev"/>
    <language>en</language>
    <item>
      <title>Computer Networking Fundamentals: IP Addresses, DNS, and Network Communication</title>
      <dc:creator>TUNDE OGUNMODEDE</dc:creator>
      <pubDate>Fri, 09 Oct 2026 13:36:03 +0000</pubDate>
      <link>https://dev.to/tunde-dev/computer-networking-fundamentals-ip-addresses-dns-and-network-communication-57kl</link>
      <guid>https://dev.to/tunde-dev/computer-networking-fundamentals-ip-addresses-dns-and-network-communication-57kl</guid>
      <description>&lt;p&gt;&lt;a href="https://tunde-dev.hashnode.dev/learning-notes" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Computer networking allows devices to communicate and exchange data. Whether you're accessing a website, connecting to a remote server, or deploying cloud infrastructure, networking concepts determine how that communication happens.&lt;/p&gt;

&lt;p&gt;Understanding these fundamentals is essential for working with Linux, cloud platforms, and DevOps tools.&lt;/p&gt;

&lt;p&gt;This guide covers network communication, IP addressing, routing, DNS, and related concepts.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Local Area Networks (LANs) and Ethernet
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;Local Area Network (LAN)&lt;/strong&gt; connects devices within a limited geographical area, such as a home, office, or data centre.&lt;/p&gt;

&lt;p&gt;Devices on a LAN can communicate with one another and share resources, depending on how the network is configured.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ethernet&lt;/strong&gt; is a widely used technology for wired networking. Wi-Fi provides a common alternative for wireless LAN connections.&lt;/p&gt;

&lt;p&gt;Although Ethernet is commonly associated with LANs, the terms are not interchangeable: a LAN describes the network's scope, while Ethernet describes a networking technology.&lt;/p&gt;

&lt;h3&gt;
  
  
  MAC addresses
&lt;/h3&gt;

&lt;p&gt;A Media Access Control (MAC) address is an identifier associated with a network interface.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;00:1A:2B:3C:4D:5E
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MAC addresses are used in local network communication, particularly when Ethernet frames are delivered between devices on the same network segment.&lt;/p&gt;

&lt;p&gt;A MAC address and an IP address serve different purposes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MAC address:&lt;/strong&gt; Used for link-layer delivery within a local network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IP address:&lt;/strong&gt; Used for addressing and routing packets across IP networks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A device's MAC address is not necessarily permanent or globally unique in every practical situation. Software can change or randomize it, and virtual machines can have their own virtual MAC addresses.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. How Devices Share a Network
&lt;/h2&gt;

&lt;p&gt;When multiple devices share a communication medium, rules are needed to coordinate transmission.&lt;/p&gt;

&lt;p&gt;Two important concepts are CSMA/CD and CSMA/CA.&lt;/p&gt;

&lt;h3&gt;
  
  
  CSMA/CD
&lt;/h3&gt;

&lt;p&gt;Carrier Sense Multiple Access with Collision Detection (CSMA/CD) was used by traditional shared, half-duplex Ethernet networks.&lt;/p&gt;

&lt;p&gt;The process works broadly as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A device listens to determine whether the medium is available.&lt;/li&gt;
&lt;li&gt;If the medium is idle, it begins transmitting.&lt;/li&gt;
&lt;li&gt;If a collision occurs, the device detects it.&lt;/li&gt;
&lt;li&gt;The devices stop transmitting and wait for a randomly selected interval before trying again.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This waiting mechanism is called &lt;strong&gt;exponential backoff&lt;/strong&gt;. The waiting period is selected from an increasingly large range as collisions recur, helping reduce repeated collisions.&lt;/p&gt;

&lt;p&gt;Traditional shared Ethernet relied on this approach. Modern switched, full-duplex Ethernet generally doesn't use CSMA/CD because devices have dedicated full-duplex links.&lt;/p&gt;

&lt;h3&gt;
  
  
  CSMA/CA
&lt;/h3&gt;

&lt;p&gt;Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) is associated with Wi-Fi.&lt;/p&gt;

&lt;p&gt;Because wireless devices cannot reliably detect every collision while transmitting, Wi-Fi uses mechanisms designed to reduce the likelihood of collisions.&lt;/p&gt;

&lt;p&gt;These mechanisms include waiting for the channel to become available and using randomized backoff periods.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bandwidth
&lt;/h3&gt;

&lt;p&gt;Bandwidth describes a network link's data-carrying capacity, commonly measured in bits per second.&lt;/p&gt;

&lt;p&gt;For example, a connection rated at 100 Mbps has a nominal capacity of 100 megabits per second.&lt;/p&gt;

&lt;p&gt;However, actual throughput may be lower because of protocol overhead, congestion, interference, and other conditions.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Collision Domains and Network Switches
&lt;/h2&gt;

&lt;p&gt;A &lt;strong&gt;collision domain&lt;/strong&gt; is a portion of a network in which simultaneous transmissions could interfere with one another under the relevant networking technology.&lt;/p&gt;

&lt;p&gt;In traditional shared Ethernet, devices sharing the same medium belonged to the same collision domain.&lt;/p&gt;

&lt;p&gt;Ethernet switches changed this arrangement.&lt;/p&gt;

&lt;p&gt;A switch forwards Ethernet frames based on MAC addresses. Each switch port generally creates a separate collision domain, and modern full-duplex connections avoid the traditional Ethernet collision problem.&lt;/p&gt;

&lt;p&gt;This is one reason switched Ethernet performs better than older shared-medium Ethernet.&lt;/p&gt;

&lt;p&gt;Don't confuse a collision domain with a broadcast domain. They describe different things, and VLANs are commonly used to divide switched networks into separate broadcast domains.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Routing and Packet Delivery
&lt;/h2&gt;

&lt;p&gt;When one device communicates with another across different IP networks, routers help move packets toward their destinations.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a packet?
&lt;/h3&gt;

&lt;p&gt;A packet is a formatted unit of data carried by a network-layer protocol such as IP.&lt;/p&gt;

&lt;p&gt;An IP packet contains information such as source and destination IP addresses, along with the data being transported.&lt;/p&gt;

&lt;p&gt;Routers examine packet headers and use routing information to determine where packets should be forwarded next.&lt;/p&gt;

&lt;p&gt;Packets belonging to the same communication may take different paths, depending on network conditions and routing decisions.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a hop count?
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;hop&lt;/strong&gt; is one step along a route through a network, typically involving a router forwarding a packet.&lt;/p&gt;

&lt;p&gt;Hop count refers to the number of hops along a route or the number of router hops a packet traverses.&lt;/p&gt;

&lt;p&gt;For example, if a packet passes through three routers before reaching its destination, it has traversed three router hops.&lt;/p&gt;

&lt;p&gt;In IPv4, the Time to Live (TTL) field is reduced by routers as the packet is forwarded. When it reaches zero, the packet is discarded.&lt;/p&gt;

&lt;p&gt;This helps prevent packets from circulating indefinitely because of routing loops.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Circuit Switching and Message Switching
&lt;/h2&gt;

&lt;p&gt;Different communication systems use different methods to move information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Circuit switching
&lt;/h3&gt;

&lt;p&gt;Circuit switching establishes a dedicated communication path or circuit between endpoints for the duration of a connection.&lt;/p&gt;

&lt;p&gt;Traditional telephone networks are a familiar example.&lt;/p&gt;

&lt;p&gt;The reserved path provides predictable communication resources, but those resources may remain allocated even when no data is being sent.&lt;/p&gt;

&lt;h3&gt;
  
  
  Message switching
&lt;/h3&gt;

&lt;p&gt;Message switching forwards complete messages from one intermediate system to another.&lt;/p&gt;

&lt;p&gt;Each intermediate system receives and stores the message before forwarding it toward the destination. This is often called a &lt;em&gt;store-and-forward&lt;/em&gt; approach.&lt;/p&gt;

&lt;p&gt;Unlike circuit switching, message switching doesn't require a dedicated end-to-end circuit.&lt;/p&gt;

&lt;p&gt;Modern IP networks generally use packet switching instead: data is divided into packets that can be forwarded independently.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. IP Addresses: IPv4 and IPv6
&lt;/h2&gt;

&lt;p&gt;An IP address identifies a network interface at the IP layer and supports communication across interconnected networks.&lt;/p&gt;

&lt;p&gt;There are two major versions of IP: IPv4 and IPv6.&lt;/p&gt;

&lt;h3&gt;
  
  
  IPv4
&lt;/h3&gt;

&lt;p&gt;IPv4 uses 32-bit addresses.&lt;/p&gt;

&lt;p&gt;Because each bit has two possible values, IPv4 provides:&lt;/p&gt;

&lt;p&gt;[&lt;br&gt;
2^{32} = 4,294,967,296&lt;br&gt;
]&lt;/p&gt;

&lt;p&gt;possible address values—approximately 4.3 billion.&lt;/p&gt;

&lt;p&gt;An IPv4 address is commonly written as four decimal numbers separated by periods.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Each number represents eight bits and ranges from 0 to 255.&lt;/p&gt;

&lt;h3&gt;
  
  
  IPv6
&lt;/h3&gt;

&lt;p&gt;IPv6 uses 128-bit addresses.&lt;/p&gt;

&lt;p&gt;It provides:&lt;/p&gt;

&lt;p&gt;[&lt;br&gt;
2^{128}&lt;br&gt;
]&lt;/p&gt;

&lt;p&gt;possible address values, offering an enormously larger address space than IPv4.&lt;/p&gt;

&lt;p&gt;An IPv6 address is commonly written in hexadecimal groups separated by colons.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2001:db8::1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;2001:db8::/32&lt;/code&gt; block is reserved for documentation and examples; it is not intended for ordinary public deployment.&lt;/p&gt;

&lt;p&gt;IPv6 was developed partly to address IPv4 address exhaustion and includes other protocol improvements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Static and dynamic IP addresses
&lt;/h3&gt;

&lt;p&gt;IP addresses can also be classified by how they are assigned.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static IP:&lt;/strong&gt; An address configured to remain fixed, unless an administrator or system changes it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dynamic IP:&lt;/strong&gt; An address assigned automatically, commonly through DHCP, and potentially changed over time.&lt;/p&gt;

&lt;p&gt;These terms describe address assignment, not IP versions. Either IPv4 or IPv6 can use static or dynamic configuration.&lt;/p&gt;

&lt;p&gt;For example, a cloud server may need a stable public IP address so that users or other systems can reach it consistently.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Congestion Control
&lt;/h2&gt;

&lt;p&gt;Network congestion occurs when the volume of traffic exceeds the capacity available along a network path.&lt;/p&gt;

&lt;p&gt;This can result in packet loss, increased latency, and reduced throughput.&lt;/p&gt;

&lt;p&gt;Congestion control helps prevent senders from overwhelming the network.&lt;/p&gt;

&lt;p&gt;TCP, for example, uses congestion-control algorithms to adjust its sending behaviour in response to network conditions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Congestion control is not the same as load balancing.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Congestion control&lt;/strong&gt; regulates traffic to reduce or respond to overload.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load balancing&lt;/strong&gt; distributes traffic across multiple resources or paths to improve resource utilization, performance, or availability.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both can help improve network performance, but they solve different problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. TCP/IP, ICMP, and BGP
&lt;/h2&gt;

&lt;p&gt;These protocols serve different purposes within network communication.&lt;/p&gt;

&lt;h3&gt;
  
  
  TCP/IP
&lt;/h3&gt;

&lt;p&gt;TCP/IP refers to the family of protocols used for communication across IP networks.&lt;/p&gt;

&lt;p&gt;IP handles addressing and packet forwarding. TCP provides a reliable, ordered byte stream between applications running on communicating hosts.&lt;/p&gt;

&lt;p&gt;Other transport protocols, such as UDP, provide different delivery characteristics.&lt;/p&gt;

&lt;h3&gt;
  
  
  ICMP
&lt;/h3&gt;

&lt;p&gt;The Internet Control Message Protocol (ICMP) supports error reporting and diagnostic functions associated with IP communication.&lt;/p&gt;

&lt;p&gt;For example, &lt;code&gt;ping&lt;/code&gt; commonly uses ICMP Echo Request and Echo Reply messages to test reachability.&lt;/p&gt;

&lt;p&gt;ICMP is not the same as TCP. They perform different functions.&lt;/p&gt;

&lt;h3&gt;
  
  
  BGP
&lt;/h3&gt;

&lt;p&gt;The Border Gateway Protocol (BGP) is used to exchange routing information between autonomous systems.&lt;/p&gt;

&lt;p&gt;An autonomous system is a network or group of networks managed under a common routing policy.&lt;/p&gt;

&lt;p&gt;BGP helps large networks, including internet service providers and major organizations, determine how traffic can reach destinations across the internet.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. The Internet of Things (IoT)
&lt;/h2&gt;

&lt;p&gt;The Internet of Things (IoT) describes physical devices connected to networks so they can collect, exchange, or act on data.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Smart home sensors.&lt;/li&gt;
&lt;li&gt;Industrial monitoring equipment.&lt;/li&gt;
&lt;li&gt;Connected security cameras.&lt;/li&gt;
&lt;li&gt;Environmental monitoring devices.&lt;/li&gt;
&lt;li&gt;Wearable devices.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These devices often communicate with cloud platforms that store information, process data, and provide monitoring or control interfaces.&lt;/p&gt;

&lt;p&gt;Networking knowledge is important for IoT because devices need appropriate addressing, connectivity, security, and reliable communication.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. DNS: The Domain Name System
&lt;/h2&gt;

&lt;p&gt;The Domain Name System (DNS) translates domain names into information that applications can use, including IP addresses.&lt;/p&gt;

&lt;p&gt;For example, when a user accesses a website using a domain name, DNS resolution can help determine the IP address associated with that name.&lt;/p&gt;

&lt;p&gt;DNS is often described as the internet's phonebook, but it is more accurately a distributed, hierarchical naming system.&lt;/p&gt;

&lt;p&gt;It does not store every website in one central location.&lt;/p&gt;

&lt;h3&gt;
  
  
  How DNS resolution works
&lt;/h3&gt;

&lt;p&gt;Consider a DNS lookup for an address record associated with a domain.&lt;/p&gt;

&lt;p&gt;Several components may participate in finding the answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Recursive resolver&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The recursive resolver receives the query on behalf of the client. If it doesn't already have a usable cached answer, it can query other DNS servers to obtain one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Root nameserver&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A root nameserver directs the resolver toward the appropriate top-level domain (TLD) nameservers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. TLD nameserver&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A TLD nameserver directs the resolver toward the authoritative nameservers for the domain.&lt;/p&gt;

&lt;p&gt;For example, a &lt;code&gt;.com&lt;/code&gt; TLD nameserver can provide a referral for a domain ending in &lt;code&gt;.com&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Authoritative nameserver&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The authoritative nameserver holds the DNS records for the domain and can return the requested information.&lt;/p&gt;

&lt;p&gt;The resolver can then return the answer to the client and cache it when appropriate.&lt;/p&gt;

&lt;p&gt;This is a simplified description: the exact process depends on the query, existing cached data, and the DNS configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  DNS caching
&lt;/h3&gt;

&lt;p&gt;DNS caching temporarily stores DNS answers so they can be reused for subsequent queries.&lt;/p&gt;

&lt;p&gt;If a resolver already has a valid cached answer, it may return that answer without repeating the entire lookup process.&lt;/p&gt;

&lt;p&gt;Caching reduces unnecessary queries and can improve response times.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is DNS Time to Live (TTL)?
&lt;/h3&gt;

&lt;p&gt;A DNS record's Time to Live (TTL) specifies how long a DNS answer can generally remain cached before it needs to be refreshed.&lt;/p&gt;

&lt;p&gt;For example, a DNS record with a TTL of 3,600 seconds can ordinarily be cached for up to one hour.&lt;/p&gt;

&lt;p&gt;A shorter TTL can allow changes to be reflected sooner after caches expire, but it can also increase DNS query traffic.&lt;/p&gt;

&lt;p&gt;A longer TTL can reduce repeated queries, although changes may take longer to be reflected by clients using cached answers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important distinction:&lt;/strong&gt; DNS TTL is different from the TTL field in an IPv4 packet. DNS TTL governs caching time, while IPv4 TTL limits how many router hops a packet can traverse before being discarded.&lt;/p&gt;




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

&lt;p&gt;Computer networking combines several technologies and protocols to enable communication between devices.&lt;/p&gt;

&lt;p&gt;Understanding LANs, MAC and IP addressing, routing, packet delivery, TCP/IP, and DNS provides a foundation for troubleshooting connectivity and understanding how applications reach network services.&lt;/p&gt;

&lt;p&gt;These concepts also underpin cloud networking, where engineers configure virtual networks, subnets, routing tables, IP addresses, DNS records, and security controls.&lt;/p&gt;

&lt;p&gt;A solid understanding of networking fundamentals makes it easier to reason about what happens when a service becomes unreachable, a DNS lookup fails, or traffic cannot reach its destination.&lt;/p&gt;

&lt;h2&gt;
  
  
  References for Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc791" rel="noopener noreferrer"&gt;RFC 791: Internet Protocol (IPv4)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc8200" rel="noopener noreferrer"&gt;RFC 8200: Internet Protocol, Version 6 (IPv6)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc1034" rel="noopener noreferrer"&gt;RFC 1034: Domain Names — Concepts and Facilities&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc1035" rel="noopener noreferrer"&gt;RFC 1035: Domain Names — Implementation and Specification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.rfc-editor.org/rfc/rfc4271" rel="noopener noreferrer"&gt;RFC 4271: Border Gateway Protocol 4 (BGP-4)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>networking</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>Cloud and DevOps Fundamentals: Git, Terraform, CI/CD, and SSH</title>
      <dc:creator>TUNDE OGUNMODEDE</dc:creator>
      <pubDate>Sat, 03 Oct 2026 11:58:06 +0000</pubDate>
      <link>https://dev.to/tunde-dev/week-2-learning-python-cloud-devops-terraform-ssh-and-cli-basics-52fp</link>
      <guid>https://dev.to/tunde-dev/week-2-learning-python-cloud-devops-terraform-ssh-and-cli-basics-52fp</guid>
      <description>&lt;p&gt;Cloud engineering involves more than creating servers. It also requires understanding how infrastructure is managed, how software changes are delivered, how systems are monitored, and how servers are accessed securely.&lt;/p&gt;

&lt;p&gt;Several tools and practices support this work, including Git, Infrastructure as Code (IaC), Continuous Integration and Continuous Delivery (CI/CD), containers, observability, Terraform, and SSH.&lt;/p&gt;

&lt;p&gt;This article introduces these concepts and explains how they fit into a cloud engineering workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Version Control with Git
&lt;/h2&gt;

&lt;p&gt;Git is a distributed version control system that tracks changes to files over time. It allows developers to review previous changes, experiment with new features, and collaborate without losing the history of a project.&lt;/p&gt;

&lt;p&gt;Git is widely used in software development and infrastructure projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Core Git concepts
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Working directory&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The working directory is where you view and modify project files.&lt;/p&gt;

&lt;p&gt;For example, when you edit a Bash script or Terraform configuration, you're changing files in your working directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Staging area&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The staging area allows you to select the changes you want to include in your next commit.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This stages the changes to &lt;code&gt;main.tf&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The local repository stores the project's Git history, including commits and branch information.&lt;/p&gt;

&lt;p&gt;To record staged changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add Terraform configuration"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Remote repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A remote repository is a version of the repository hosted elsewhere, such as on GitHub. It allows you to share your work and collaborate with other people.&lt;/p&gt;

&lt;p&gt;Common commands include:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;git push&lt;/code&gt; sends local commits to a remote repository, while &lt;code&gt;git pull&lt;/code&gt; fetches and integrates changes from a remote repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Branches&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Branches allow you to develop features or make changes independently of another branch.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch &lt;span class="nt"&gt;-c&lt;/span&gt; add-monitoring
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates and switches to a new branch named &lt;code&gt;add-monitoring&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pull requests&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A pull request is a proposal to merge changes from one branch into another. It gives team members an opportunity to review and discuss the changes before they are integrated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Merging&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Merging integrates changes from one branch into another. For example, a feature branch may be merged into the main branch after review.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Git matters in cloud engineering
&lt;/h3&gt;

&lt;p&gt;Infrastructure configurations are files too. By storing Terraform configurations and scripts in Git, you can track infrastructure changes, review proposed modifications, and recover earlier versions of your configuration.&lt;/p&gt;

&lt;p&gt;Version control makes infrastructure work more transparent and repeatable.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Infrastructure as Code (IaC)
&lt;/h2&gt;

&lt;p&gt;Infrastructure as Code is the practice of defining and managing infrastructure through machine-readable configuration files rather than relying entirely on manual setup.&lt;/p&gt;

&lt;p&gt;Instead of repeatedly clicking through a cloud provider's console to create servers and networks, you describe the desired infrastructure in configuration files.&lt;/p&gt;

&lt;p&gt;These files can be version-controlled, reviewed, reused, and applied consistently.&lt;/p&gt;

&lt;p&gt;For example, a Terraform configuration can describe an AWS EC2 instance, including its instance type and other settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why IaC is useful
&lt;/h3&gt;

&lt;p&gt;IaC can help teams:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reproduce infrastructure environments.&lt;/li&gt;
&lt;li&gt;Reduce repetitive manual configuration.&lt;/li&gt;
&lt;li&gt;Review infrastructure changes before applying them.&lt;/li&gt;
&lt;li&gt;Track configuration history in Git.&lt;/li&gt;
&lt;li&gt;Standardize infrastructure across development and production environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;IaC does not automatically guarantee that every deployment will be identical. Results also depend on the configuration, provider behaviour, external dependencies, and the state of the environment.&lt;/p&gt;

&lt;p&gt;The main advantage is that infrastructure becomes defined and managed through explicit, reviewable configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Continuous Integration and Continuous Delivery/Deployment (CI/CD)
&lt;/h2&gt;

&lt;p&gt;CI/CD describes practices and automation used to integrate, test, and deliver software changes.&lt;/p&gt;

&lt;p&gt;The abbreviation has two main components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Continuous Integration (CI)
&lt;/h3&gt;

&lt;p&gt;Continuous Integration involves regularly integrating code changes into a shared codebase.&lt;/p&gt;

&lt;p&gt;Automated checks may run when changes are pushed or a pull request is opened. These checks can include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Running tests.&lt;/li&gt;
&lt;li&gt;Checking code quality.&lt;/li&gt;
&lt;li&gt;Validating configuration files.&lt;/li&gt;
&lt;li&gt;Building an application.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is to detect problems early, before changes progress further through the delivery process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Continuous Delivery and Continuous Deployment
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Continuous Delivery&lt;/strong&gt; automates the process of preparing software for release. A production deployment may still require human approval.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Deployment&lt;/strong&gt; goes further: changes that pass the required checks can be released automatically to production.&lt;/p&gt;

&lt;p&gt;A simplified pipeline might look like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A developer pushes a change to Git.&lt;/li&gt;
&lt;li&gt;An automated pipeline runs tests.&lt;/li&gt;
&lt;li&gt;The application is built and validated.&lt;/li&gt;
&lt;li&gt;The deployment process prepares or releases the application.&lt;/li&gt;
&lt;li&gt;Monitoring helps identify problems after deployment.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;CI/CD reduces repetitive work and helps teams deliver changes more consistently. However, automation is only as reliable as the tests, deployment procedures, and safeguards behind it.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Observability: Understanding What's Happening Inside a System
&lt;/h2&gt;

&lt;p&gt;Observability is the ability to understand a system's internal state by examining the information it produces.&lt;/p&gt;

&lt;p&gt;When an application becomes slow or fails, engineers need evidence to investigate the cause rather than relying on guesses.&lt;/p&gt;

&lt;p&gt;Three commonly discussed observability signals are logs, metrics, and traces.&lt;/p&gt;

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

&lt;p&gt;Logs are records of events produced by an application or system.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2026-10-09 10:32:00 ERROR Database connection failed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A log entry may help an engineer identify what happened and when it occurred.&lt;/p&gt;

&lt;h3&gt;
  
  
  Metrics
&lt;/h3&gt;

&lt;p&gt;Metrics are numerical measurements collected over time.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;CPU utilization.&lt;/li&gt;
&lt;li&gt;Memory usage.&lt;/li&gt;
&lt;li&gt;Request rate.&lt;/li&gt;
&lt;li&gt;Error rate.&lt;/li&gt;
&lt;li&gt;Request latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Metrics can help engineers identify trends, unusual behaviour, and performance problems.&lt;/p&gt;

&lt;p&gt;For example, a steady increase in memory usage may indicate a resource leak or growing workload.&lt;/p&gt;

&lt;h3&gt;
  
  
  Traces
&lt;/h3&gt;

&lt;p&gt;Distributed traces follow a request as it passes through multiple components of an application.&lt;/p&gt;

&lt;p&gt;Imagine an application request moving through an API, a payment service, and a database. A trace can help show which part of that journey contributed most to the delay.&lt;/p&gt;

&lt;h3&gt;
  
  
  Monitoring and observability
&lt;/h3&gt;

&lt;p&gt;Monitoring commonly involves tracking predefined indicators and alerting when they cross certain thresholds.&lt;/p&gt;

&lt;p&gt;Observability helps engineers investigate less predictable problems by examining system telemetry and relationships between events.&lt;/p&gt;

&lt;p&gt;They complement each other: monitoring can tell you that something is wrong, while observability can help you investigate why.&lt;/p&gt;

&lt;p&gt;Collecting data is only one part of the process. Teams also need suitable tools, useful dashboards, appropriate alerts, and a method for investigating what the data reveals.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Containers and Kubernetes
&lt;/h2&gt;

&lt;p&gt;Applications often depend on specific libraries, configuration files, and runtime components. Differences between environments can cause an application to work on one machine but fail on another.&lt;/p&gt;

&lt;p&gt;Containers help address this problem by packaging an application with its required dependencies and isolating its processes from the surrounding system.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a container?
&lt;/h3&gt;

&lt;p&gt;A container is an isolated environment in which an application runs.&lt;/p&gt;

&lt;p&gt;Containers commonly use images that package the application and its required components. The same image can be used across different environments, provided the necessary runtime and platform requirements are met.&lt;/p&gt;

&lt;p&gt;Containers are generally lighter than traditional virtual machines because they share the host operating system's kernel rather than each requiring a separate guest operating system.&lt;/p&gt;

&lt;p&gt;However, a container does not automatically guarantee identical behaviour everywhere. Environment variables, permissions, networking, storage, and other external dependencies can still affect how it runs.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Kubernetes?
&lt;/h3&gt;

&lt;p&gt;Kubernetes is a container orchestration platform.&lt;/p&gt;

&lt;p&gt;When an application runs across many containers and machines, managing each container manually becomes difficult. Kubernetes helps automate tasks such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Scheduling containers across available machines.&lt;/li&gt;
&lt;li&gt;Restarting containers when they fail.&lt;/li&gt;
&lt;li&gt;Scaling workloads.&lt;/li&gt;
&lt;li&gt;Managing service discovery and networking.&lt;/li&gt;
&lt;li&gt;Maintaining the desired number of application replicas.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, you might configure a workload to run three replicas of an application. Kubernetes works to maintain that desired state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The distinction:&lt;/strong&gt; Containers provide an environment for running applications; Kubernetes helps manage containerized workloads at scale.&lt;/p&gt;

&lt;p&gt;Kubernetes is a useful technology to understand, but you don't need to master it before learning the fundamentals of Linux, networking, and cloud infrastructure.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Terraform: Managing Infrastructure with Code
&lt;/h2&gt;

&lt;p&gt;Terraform is an Infrastructure as Code tool that allows you to define infrastructure using configuration files.&lt;/p&gt;

&lt;p&gt;Instead of manually creating resources in a cloud console, you describe what you want Terraform to manage.&lt;/p&gt;

&lt;p&gt;For example, you can define an AWS EC2 instance in a Terraform configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Terraform workflow
&lt;/h3&gt;

&lt;p&gt;A typical workflow has three important commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Initialize&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This initializes a Terraform working directory. Terraform downloads the required providers and prepares the directory for further operations.&lt;/p&gt;

&lt;p&gt;Run it when setting up a new configuration or when initializing a project cloned from version control.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Plan&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Terraform compares the desired configuration with its understanding of the existing infrastructure and produces a proposed execution plan.&lt;/p&gt;

&lt;p&gt;Reviewing the plan helps you understand which resources Terraform intends to create, change, or destroy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Apply&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Terraform executes the proposed changes, subject to its planning and approval workflow.&lt;/p&gt;

&lt;p&gt;For example, it may create an EC2 instance in AWS based on your configuration.&lt;/p&gt;

&lt;p&gt;Always review the proposed changes before approving an apply operation, particularly when working with existing infrastructure.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding a Terraform provider configuration
&lt;/h3&gt;

&lt;p&gt;A Terraform configuration may contain the following block:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight hcl"&gt;&lt;code&gt;&lt;span class="nx"&gt;terraform&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;required_providers&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;aws&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;source&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"hashicorp/aws"&lt;/span&gt;
      &lt;span class="nx"&gt;version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"~&amp;gt; 5.92"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;required_version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&amp;gt;= 1.2"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break it down.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;terraform&lt;/code&gt;&lt;/strong&gt; is a Terraform configuration block.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;required_providers&lt;/code&gt;&lt;/strong&gt; declares the providers the configuration needs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;aws&lt;/code&gt;&lt;/strong&gt; is the local name assigned to the provider in this configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;source = "hashicorp/aws"&lt;/code&gt;&lt;/strong&gt; identifies the AWS provider in the Terraform Registry.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;version = "~&amp;gt; 5.92"&lt;/code&gt;&lt;/strong&gt; specifies a provider version constraint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;required_version = "&amp;gt;= 1.2"&lt;/code&gt;&lt;/strong&gt; specifies the minimum Terraform CLI version permitted by the configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The version constraints above are examples from the configuration in my notes, not recommendations to use those versions in every new project. Check the current Terraform documentation and provider registry when starting a new configuration.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;~&amp;gt; 5.92&lt;/code&gt; constraint allows compatible releases within the relevant version range; it does not mean Terraform will always install exactly version 5.92.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Terraform matters
&lt;/h3&gt;

&lt;p&gt;Terraform makes it possible to define infrastructure in a repeatable and reviewable way.&lt;/p&gt;

&lt;p&gt;Combined with Git, it also provides a history of configuration changes that can help engineers understand how infrastructure has evolved.&lt;/p&gt;

&lt;p&gt;Before using Terraform to manage real resources, it's important to understand its state file, resource dependencies, provider configuration, and the costs associated with creating cloud resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. SSH: Securely Accessing Remote Systems
&lt;/h2&gt;

&lt;p&gt;SSH stands for Secure Shell. It is a protocol for securely connecting to and managing remote computers over a network.&lt;/p&gt;

&lt;p&gt;Cloud engineers commonly use SSH to access Linux servers for administration, troubleshooting, and maintenance.&lt;/p&gt;

&lt;p&gt;SSH typically uses TCP port &lt;strong&gt;22&lt;/strong&gt; by default, although administrators can configure a different port.&lt;/p&gt;

&lt;h3&gt;
  
  
  What SSH provides
&lt;/h3&gt;

&lt;p&gt;SSH supports several important capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remote administration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An engineer can connect to a remote Linux server and execute commands.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh username@server-ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;username&lt;/code&gt; is the account on the remote machine, and &lt;code&gt;server-ip&lt;/code&gt; is the server's IP address or resolvable hostname.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Secure file transfer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tools such as &lt;code&gt;scp&lt;/code&gt; and &lt;code&gt;sftp&lt;/code&gt; use SSH-related functionality to transfer files securely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;SSH supports several authentication methods, including passwords and public-key authentication.&lt;/p&gt;

&lt;p&gt;With public-key authentication, the user keeps a private key and configures the corresponding public key on the remote system. The server can verify that the client possesses the matching private key without requiring the private key itself to be sent to the server.&lt;/p&gt;

&lt;p&gt;SSH also negotiates encryption keys to protect the session's communications. Public-key cryptography is not simply used to encrypt every piece of data transmitted during the session.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSH tunnelling and port forwarding
&lt;/h3&gt;

&lt;p&gt;SSH port forwarding allows traffic to travel through an SSH connection to reach another address and port.&lt;/p&gt;

&lt;p&gt;For example, an engineer may need to access a service running on a remote server without exposing that service directly to the public internet.&lt;/p&gt;

&lt;p&gt;A local forwarding example is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-L&lt;/span&gt; 8080:localhost:80 username@server-ip
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This forwards connections to port &lt;code&gt;8080&lt;/code&gt; on the local machine through the SSH connection to port &lt;code&gt;80&lt;/code&gt; on the remote server's &lt;code&gt;localhost&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The exact destination depends on the forwarding configuration. In this example, &lt;code&gt;localhost:80&lt;/code&gt; is interpreted from the remote server's perspective.&lt;/p&gt;

&lt;p&gt;SSH tunnelling can help provide controlled access to services, but it does not automatically bypass every firewall or security restriction. The SSH server, network rules, authentication, and destination service must permit the connection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why SSH matters in cloud engineering
&lt;/h3&gt;

&lt;p&gt;SSH is useful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Administering remote Linux servers.&lt;/li&gt;
&lt;li&gt;Investigating application or system problems.&lt;/li&gt;
&lt;li&gt;Transferring files securely.&lt;/li&gt;
&lt;li&gt;Accessing services that should not be publicly exposed.&lt;/li&gt;
&lt;li&gt;Establishing encrypted tunnels to permitted network destinations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For cloud environments, access should be restricted to authorized users and trusted networks wherever practical. Private keys should be protected, and SSH access should follow the security controls of the environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Essential Linux Networking Commands
&lt;/h2&gt;

&lt;p&gt;Cloud engineers frequently use Linux commands to inspect interfaces, addresses, and routing information.&lt;/p&gt;

&lt;p&gt;Two particularly useful commands are &lt;code&gt;ip addr&lt;/code&gt; and &lt;code&gt;ip route&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;ip addr&lt;/code&gt;
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;p&gt;This displays information about network interfaces and their IP addresses.&lt;/p&gt;

&lt;p&gt;It can help answer questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which network interfaces are available?&lt;/li&gt;
&lt;li&gt;What IP addresses are assigned?&lt;/li&gt;
&lt;li&gt;Is an interface up or down?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;ip route&lt;/code&gt;
&lt;/h3&gt;



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

&lt;/div&gt;



&lt;p&gt;This displays the IPv4 routing table.&lt;/p&gt;

&lt;p&gt;It helps you understand where the system sends traffic and which gateway it may use to reach destinations outside its local network.&lt;/p&gt;

&lt;p&gt;For example, an output line such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;default via 192.168.1.1 dev eth0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;indicates that the default route uses &lt;code&gt;192.168.1.1&lt;/code&gt; as its gateway through the &lt;code&gt;eth0&lt;/code&gt; interface.&lt;/p&gt;

&lt;p&gt;The actual interface name and gateway will depend on the system's network configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  What about &lt;code&gt;ifconfig&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;ifconfig&lt;/code&gt; is an older utility used to inspect and configure network interfaces. On many modern Linux distributions, the &lt;code&gt;ip&lt;/code&gt; command from the &lt;code&gt;iproute2&lt;/code&gt; package is preferred.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ip addr
ip route
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These commands provide much of the interface and routing information beginners commonly seek with &lt;code&gt;ifconfig&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What about &lt;code&gt;iwconfig&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;iwconfig&lt;/code&gt; is an older utility for inspecting and configuring wireless network interfaces.&lt;/p&gt;

&lt;p&gt;Depending on the Linux distribution, it may not be installed by default. Modern Linux systems commonly use &lt;code&gt;iw&lt;/code&gt; for wireless-specific operations.&lt;/p&gt;

&lt;p&gt;The commands serve different purposes:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Primary purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ip addr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Inspect network interfaces and IP addresses&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ip route&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Inspect routing information&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;iwconfig&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Inspect or configure wireless interface settings using the older wireless tools&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;iw&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Inspect or configure wireless devices using the modern wireless utility&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A virtual machine may not expose a physical wireless interface to its guest operating system. For example, an Ubuntu VM using a virtual Ethernet adapter may not have access to the host Mac's Wi-Fi interface directly. In that case, &lt;code&gt;iw&lt;/code&gt; or &lt;code&gt;iwconfig&lt;/code&gt; may not show a wireless interface, even when the host computer is connected to Wi-Fi.&lt;/p&gt;




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

&lt;p&gt;Cloud and DevOps engineering bring together tools and practices that make infrastructure easier to manage, software changes easier to deliver, and system behaviour easier to investigate.&lt;/p&gt;

&lt;p&gt;The concepts covered here play different roles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Git&lt;/strong&gt; tracks changes to code and configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure as Code&lt;/strong&gt; defines infrastructure in reusable files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD&lt;/strong&gt; automates testing and software delivery.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observability&lt;/strong&gt; helps engineers understand system behaviour.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Containers&lt;/strong&gt; package applications and their dependencies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kubernetes&lt;/strong&gt; orchestrates containerized workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Terraform&lt;/strong&gt; provisions and manages infrastructure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SSH&lt;/strong&gt; enables secure remote access and tunnelling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux networking commands&lt;/strong&gt; help troubleshoot interfaces, addresses, and routes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These technologies become more useful when understood as parts of a workflow rather than as isolated tools.&lt;/p&gt;

&lt;p&gt;For someone entering cloud engineering, the practical next step is to build small projects that combine these fundamentals—for example, managing a cloud server with Terraform, tracking the configuration in Git, and connecting to the server securely with SSH.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/doc" rel="noopener noreferrer"&gt;Git Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.hashicorp.com/terraform/docs" rel="noopener noreferrer"&gt;Terraform Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs" rel="noopener noreferrer"&gt;AWS Provider Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions" rel="noopener noreferrer"&gt;GitHub Actions Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kubernetes.io/docs/home/" rel="noopener noreferrer"&gt;Kubernetes Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://opentelemetry.io/docs/" rel="noopener noreferrer"&gt;OpenTelemetry Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.openssh.com/manual.html" rel="noopener noreferrer"&gt;OpenSSH Manual Pages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://man7.org/linux/man-pages/man8/ip.8.html" rel="noopener noreferrer"&gt;Linux &lt;code&gt;ip&lt;/code&gt; command manual&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cloudcomputing</category>
      <category>devops</category>
      <category>newbie</category>
    </item>
    <item>
      <title>Bash Scripting Fundamentals: Commands, Variables, Loops, and Automation</title>
      <dc:creator>TUNDE OGUNMODEDE</dc:creator>
      <pubDate>Sat, 26 Sep 2026 22:20:33 +0000</pubDate>
      <link>https://dev.to/tunde-dev/learning-notes-289g</link>
      <guid>https://dev.to/tunde-dev/learning-notes-289g</guid>
      <description>&lt;h2&gt;
  
  
  Commands, Variables, Loops, and Automation
&lt;/h2&gt;

&lt;p&gt;Bash scripting allows you to automate repetitive tasks in Linux by combining commands into scripts that execute in sequence. Instead of repeatedly typing the same commands into a terminal, you can save them in a file and execute them whenever needed.&lt;/p&gt;

&lt;p&gt;This is useful for everyday Linux administration, file management, system checks, and scheduled tasks.&lt;/p&gt;

&lt;p&gt;This guide covers the fundamentals of Bash scripting, from creating your first script to working with loops, processing files, debugging, and scheduling automated tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. What Is a Bash Script?
&lt;/h2&gt;

&lt;p&gt;A Bash script is a text file containing commands that the Bash shell can interpret and execute.&lt;/p&gt;

&lt;p&gt;For example, instead of typing several commands individually, you can save them in a script and execute them together.&lt;/p&gt;

&lt;p&gt;Create a file called &lt;code&gt;hello.sh&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="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello, World!"&lt;/span&gt;
&lt;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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's break this down.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;#!/bin/bash&lt;/code&gt; — The shebang identifies the interpreter to use when the script is executed directly.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;echo&lt;/code&gt; — Prints text to standard output.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$(date)&lt;/code&gt; — Runs the &lt;code&gt;date&lt;/code&gt; command and substitutes its output into the surrounding command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To make the script executable, run:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Then execute it:&lt;br&gt;
&lt;/p&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;The terminal will display the messages and the current date.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why use scripts?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Scripts reduce repetitive work, make tasks easier to reproduce, and provide a foundation for automating system administration.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Variables and User Input
&lt;/h2&gt;

&lt;p&gt;Variables allow scripts to store and reuse values.&lt;/p&gt;

&lt;p&gt;Consider this example:&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Wale"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"My name is &lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;name&lt;/code&gt; is a variable containing the value &lt;code&gt;Wale&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;$name&lt;/code&gt; expression retrieves that value.&lt;/p&gt;

&lt;p&gt;Notice that there are no spaces around the &lt;code&gt;=&lt;/code&gt; when assigning a value in Bash:&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;"Wale"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is different from:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;name &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Wale"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second example is not a valid variable assignment in Bash.&lt;/p&gt;

&lt;h3&gt;
  
  
  Accepting user input
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;read&lt;/code&gt; command allows a script to receive input from the user.&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"What is your name?"&lt;/span&gt;

&lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; name

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

&lt;/div&gt;



&lt;p&gt;When executed, the script waits for the user to enter a name and press Enter.&lt;/p&gt;

&lt;p&gt;The entered value is stored in the &lt;code&gt;name&lt;/code&gt; variable and displayed in the final message.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;-r&lt;/code&gt; option prevents &lt;code&gt;read&lt;/code&gt; from treating backslashes as escape characters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Passing arguments to a script
&lt;/h3&gt;

&lt;p&gt;You can also supply values when executing a script.&lt;/p&gt;

&lt;p&gt;Consider &lt;code&gt;greeting.sh&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="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"My name is &lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Execute it with:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;My name is Wale
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;$1&lt;/code&gt; represents the first positional argument passed to the script.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;$1&lt;/code&gt; — First argument.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$2&lt;/code&gt; — Second argument.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$3&lt;/code&gt; — Third argument.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows scripts to accept different values without requiring interactive input.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Working with Files and Command Output
&lt;/h2&gt;

&lt;p&gt;Linux commands can read from files and redirect their output into files.&lt;/p&gt;

&lt;p&gt;Understanding these operations is essential for writing useful scripts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Redirecting output
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;&amp;gt;&lt;/code&gt; operator redirects command output into a file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; output.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This writes the directory listing to &lt;code&gt;output.txt&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; If the file already exists, &lt;code&gt;&amp;gt;&lt;/code&gt; overwrites its contents.&lt;/p&gt;

&lt;p&gt;To append output instead, use &lt;code&gt;&amp;gt;&amp;gt;&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;"Another entry"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; output.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This adds the new text to the end of the file without replacing the existing contents.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reading file contents
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;cat&lt;/code&gt; command displays a file's contents:&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;cat &lt;/span&gt;output.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By contrast:&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;ls &lt;/span&gt;output.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;lists the file itself rather than displaying its contents.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reading input from a file
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;&amp;lt;&lt;/code&gt; operator redirects a file's contents into a command's standard input.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;while &lt;/span&gt;&lt;span class="nv"&gt;IFS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; line
&lt;span class="k"&gt;do
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$line&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt; &amp;lt; output.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This reads &lt;code&gt;output.txt&lt;/code&gt; one line at a time and prints each line.&lt;/p&gt;

&lt;p&gt;The expression:&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="k"&gt;done&lt;/span&gt; &amp;lt; output.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;redirects the loop's standard input from the file.&lt;/p&gt;

&lt;p&gt;This pattern is useful when processing text files line by line.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Understanding Loops
&lt;/h2&gt;

&lt;p&gt;Loops allow a script to repeat commands without requiring you to write the same instructions multiple times.&lt;/p&gt;

&lt;p&gt;Bash supports several types of loops, including &lt;code&gt;while&lt;/code&gt; and &lt;code&gt;for&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The &lt;code&gt;while&lt;/code&gt; loop
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;while&lt;/code&gt; loop continues executing as long as its condition is true.&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="nv"&gt;i&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;$i&lt;/span&gt; &lt;span class="nt"&gt;-le&lt;/span&gt; 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;"&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="o"&gt;((&lt;/span&gt;i +&lt;span class="o"&gt;=&lt;/span&gt; 1&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;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
2
3
4
5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;i=1&lt;/code&gt; initializes the variable.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;[[ $i -le 5 ]]&lt;/code&gt; checks whether &lt;code&gt;i&lt;/code&gt; is less than or equal to 5.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;do&lt;/code&gt; marks the beginning of the commands to execute.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;echo "$i"&lt;/code&gt; prints the current value.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;((i += 1))&lt;/code&gt; increments the variable by one.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;done&lt;/code&gt; marks the end of the loop.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When &lt;code&gt;i&lt;/code&gt; becomes 6, the condition is false and the loop stops.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Watch out:&lt;/strong&gt; If the variable never changes in a way that makes the condition false, the loop may run indefinitely.&lt;/p&gt;

&lt;h3&gt;
  
  
  The &lt;code&gt;for&lt;/code&gt; loop
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;for&lt;/code&gt; loop is useful when iterating over a known sequence of values.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
2
3
4
5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;{1..5}&lt;/code&gt; expands into the sequence of numbers from 1 to 5.&lt;/p&gt;

&lt;p&gt;The loop assigns each value to &lt;code&gt;i&lt;/code&gt; and executes the commands inside the loop.&lt;/p&gt;

&lt;p&gt;Unlike the previous example, you don't need to increment the variable manually.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Using &lt;code&gt;case&lt;/code&gt; for Multiple Conditions
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;case&lt;/code&gt; statement allows a script to compare a value against several patterns and execute the commands associated with the first matching pattern.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="nv"&gt;fruit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"apple"&lt;/span&gt;

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$fruit&lt;/span&gt;&lt;span class="s2"&gt;"&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;"This is an apple."&lt;/span&gt;
        &lt;span class="p"&gt;;;&lt;/span&gt;
    orange&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"This is an orange."&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;"This fruit is not recognized."&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;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;This is an apple.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's what the syntax means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;case "$fruit" in&lt;/code&gt; — Begins the comparison.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;apple)&lt;/code&gt; — Matches the value &lt;code&gt;apple&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;;;&lt;/code&gt; — Ends that case and exits the &lt;code&gt;case&lt;/code&gt; statement.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;*)&lt;/code&gt; — Acts as the default pattern when no earlier pattern matches.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;esac&lt;/code&gt; — Marks the end of the statement.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;code&gt;case&lt;/code&gt; statement is useful when a script needs to respond differently to multiple possible inputs.&lt;/p&gt;

&lt;p&gt;For example, it can process user choices, command-line options, or service names.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Debugging Bash Scripts
&lt;/h2&gt;

&lt;p&gt;A script may fail because of incorrect syntax, unexpected input, or incorrect assumptions about how a command behaves.&lt;/p&gt;

&lt;p&gt;Bash provides tools to help identify these problems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using &lt;code&gt;set -x&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Add this line near the beginning of your script:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Bash will print commands and their expanded arguments to standard error as it executes them.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;The trace helps you see how Bash interprets and executes the commands.&lt;/p&gt;

&lt;p&gt;You can also enable tracing for a particular section:&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;set&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt;

&lt;span class="c"&gt;# Commands to investigate&lt;/span&gt;

&lt;span class="nb"&gt;set&lt;/span&gt; +x
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first command enables tracing, while the second disables it.&lt;/p&gt;

&lt;p&gt;This is useful when you want to investigate a specific part of a script rather than trace every command.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security note:&lt;/strong&gt; Be careful when debugging scripts that handle passwords, access tokens, or other secrets. Tracing can expose sensitive values in terminal output or logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Scheduling Scripts with Cron
&lt;/h2&gt;

&lt;p&gt;Some tasks need to run automatically at particular times.&lt;/p&gt;

&lt;p&gt;For example, you might want a script to run every morning, periodically check a service, or perform a routine maintenance task.&lt;/p&gt;

&lt;p&gt;On Linux systems that use cron, scheduled jobs can be managed with &lt;code&gt;crontab&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Viewing scheduled jobs
&lt;/h3&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This displays the current user's scheduled cron jobs.&lt;/p&gt;

&lt;p&gt;To edit them, run:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Understanding cron syntax
&lt;/h3&gt;

&lt;p&gt;A standard cron expression contains five fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* * * * *
│ │ │ │ │
│ │ │ │ └── Day of the week
│ │ │ └──── Month
│ │ └────── Day of the month
│ └──────── Hour
└────────── Minute
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each field controls when the scheduled command runs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 1: Run a script every day at midnight
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;0 0 * * * /path/to/script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The five fields specify minute 0, hour 0, and every day, month, and weekday.&lt;/p&gt;

&lt;p&gt;The script runs at midnight each day, according to the cron daemon's time settings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 2: Run a script every five minutes
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*/5 * * * * /path/to/script.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;*/5&lt;/code&gt; expression means every five minutes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practical consideration:&lt;/strong&gt; When scheduling scripts, use appropriate file permissions and valid paths. Cron jobs may also need explicit environment variables or logging because they don't necessarily run with the same environment as your interactive terminal.&lt;/p&gt;




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

&lt;p&gt;Bash scripting provides a practical way to automate tasks in Linux.&lt;/p&gt;

&lt;p&gt;The fundamentals covered here—variables, user input, positional arguments, file redirection, loops, conditional selection, debugging, and scheduling—form a foundation for more advanced automation.&lt;/p&gt;

&lt;p&gt;As scripts become more complex, these concepts can be combined to perform repetitive administrative tasks, process files, and support infrastructure operations.&lt;/p&gt;

&lt;p&gt;The key is to understand what each command does, how the pieces fit together, and how to verify that a script behaves as expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.gnu.org/software/bash/manual/bash.html" rel="noopener noreferrer"&gt;GNU Bash Reference Manual&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html" rel="noopener noreferrer"&gt;Bash Builtins: &lt;code&gt;read&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html" rel="noopener noreferrer"&gt;Bash Debugging with &lt;code&gt;set -x&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>learning</category>
      <category>bash</category>
      <category>linux</category>
      <category>newbie</category>
    </item>
  </channel>
</rss>
