<?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: Mohammed Yasir Khan</title>
    <description>The latest articles on DEV Community by Mohammed Yasir Khan (@mohammed_yasirkhan_9fc2d).</description>
    <link>https://dev.to/mohammed_yasirkhan_9fc2d</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%2F3528741%2Fd1e2eb21-ee91-4f68-a9f8-3287a6481437.png</url>
      <title>DEV Community: Mohammed Yasir Khan</title>
      <link>https://dev.to/mohammed_yasirkhan_9fc2d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohammed_yasirkhan_9fc2d"/>
    <language>en</language>
    <item>
      <title>Linux Fundamentals for DevOps &amp; SRE: The Only Guide You'll Ever Need</title>
      <dc:creator>Mohammed Yasir Khan</dc:creator>
      <pubDate>Thu, 25 Sep 2025 09:50:12 +0000</pubDate>
      <link>https://dev.to/mohammed_yasirkhan_9fc2d/linux-fundamentals-for-devops-sre-the-only-guide-youll-ever-need-4d5n</link>
      <guid>https://dev.to/mohammed_yasirkhan_9fc2d/linux-fundamentals-for-devops-sre-the-only-guide-youll-ever-need-4d5n</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;My Story&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;As a fresher DevOps engineer, I didn't start with production experience — I started with curiosity. Most of my first steps in Linux came from setting up small projects on my laptop and cloud free-tiers: spinning up an EC2 instance, SSH-ing into it, breaking things, and then figuring out how to fix them. Every "command not found" error, every "permission denied" taught me something new.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;That's when it clicked for me: Linux isn't just an operating system, it's the foundation of DevOps and SRE. This guide is a collection of what I've learned so far — the exact concepts and commands that helped me go from "where do I even start?" to "I can confidently work on Linux in my DevOps journey."&lt;/em&gt;&lt;/p&gt;




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

&lt;p&gt;Linux is an open-source operating system kernel first released by Linus Torvalds in 1991. Over the years, it grew into a family of distributions (distros) such as Ubuntu, CentOS, Debian, and Amazon Linux.&lt;/p&gt;

&lt;p&gt;Unlike Windows or macOS, Linux is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Free and open-source:&lt;/strong&gt; anyone can inspect, modify, and distribute it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stable and secure:&lt;/strong&gt; runs most of the world's servers and cloud infrastructure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lightweight and customizable:&lt;/strong&gt; you only install what you need, no bloat.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 &lt;strong&gt;Fun fact:&lt;/strong&gt; Over 90% of cloud servers and 100% of Kubernetes clusters run on Linux. If you're in DevOps/SRE, Linux isn't optional — it's the default.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;2. Why Linux is Used in DevOps &amp;amp; SRE&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;So, why does every DevOps/SRE engineer swear by Linux?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Runs the Cloud:&lt;/strong&gt; All major cloud providers (AWS, GCP, Azure) use Linux-based images for VMs, containers, and managed services.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automation-Friendly:&lt;/strong&gt; Tools like Ansible, Terraform, and Kubernetes integrate naturally with Linux.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security:&lt;/strong&gt; Strong permission model and open-source review make it a security-first OS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility:&lt;/strong&gt; From a Raspberry Pi to a 1000-node Kubernetes cluster, Linux scales everywhere.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ecosystem:&lt;/strong&gt; Docker, Kubernetes, Jenkins, Prometheus — all cloud-native tooling runs best on Linux.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; When your AWS EC2 server is unresponsive, you'll likely SSH into a Linux box, check logs in &lt;code&gt;/var/log/&lt;/code&gt;, restart services with &lt;code&gt;systemctl&lt;/code&gt;, and debug with &lt;code&gt;journalctl&lt;/code&gt;.&lt;br&gt;
That's why Linux mastery = faster incident resolution.&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;3. Problems Linux Solves&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What?&lt;/strong&gt;&lt;br&gt;
Before Linux, organizations relied on proprietary, closed-source operating systems (like Windows Server or Solaris) that were costly, less flexible, and not cloud-native.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt;&lt;br&gt;
Linux solves key problems that modern DevOps/SRE teams face:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Vendor Lock-in:&lt;/strong&gt; Proprietary OS meant paying high license fees. Linux is open-source and free.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability Issues:&lt;/strong&gt; Old systems weren't built for cloud-native workloads; Linux scales effortlessly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limited Automation:&lt;/strong&gt; Windows had GUI-heavy operations; Linux enables automation with scripts and tools.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance &amp;amp; Stability:&lt;/strong&gt; Linux is lightweight, stable, and can run for months without a reboot.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Community &amp;amp; Ecosystem:&lt;/strong&gt; Thousands of engineers contribute, so bugs/security issues are fixed quickly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; If your Kubernetes cluster runs 500 microservices, Linux ensures consistency across all nodes. Running that on a GUI-heavy OS would be inefficient, costly, and unstable.&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;4. Advantages (Why Linux is Loved in DevOps/SRE)&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Open Source &amp;amp; Free:&lt;/strong&gt; No license fees, huge community support.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security:&lt;/strong&gt; Strong permission and user model, SELinux, AppArmor.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stability &amp;amp; Reliability:&lt;/strong&gt; Servers can run for years without downtime.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance:&lt;/strong&gt; Optimized for resource usage — perfect for cloud workloads.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customizability:&lt;/strong&gt; Choose minimal distros for containers or full-featured ones for enterprise.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automation-First:&lt;/strong&gt; Command-line interface is powerful and scriptable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud-Native:&lt;/strong&gt; All major cloud tools and orchestration platforms are Linux-first.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;5. Disadvantages (Where Linux is Hard)&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Steep Learning Curve:&lt;/strong&gt; For beginners, CLI feels overwhelming.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fragmentation:&lt;/strong&gt; Many distros, slightly different commands (apt vs yum).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Desktop Usage:&lt;/strong&gt; Limited adoption in consumer laptops → less exposure before entering industry.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Support Needs:&lt;/strong&gt; Enterprise support often requires Red Hat/SUSE subscriptions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;💡 &lt;strong&gt;Tip for Juniors:&lt;/strong&gt; Don't worry about mastering all distros. Focus on 1–2 (like Ubuntu + CentOS/RHEL) and build confidence.&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;5. Linux Distributions (Distros) for DevOps/SRE&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What?&lt;/strong&gt;&lt;br&gt;
A Linux distribution (distro) is a version of Linux that includes the &lt;strong&gt;kernel&lt;/strong&gt;, &lt;strong&gt;package managers&lt;/strong&gt;, and &lt;strong&gt;tools&lt;/strong&gt;. Each distro is tailored for different use cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why?&lt;/strong&gt;&lt;br&gt;
Different distros are optimized for enterprise servers, cloud workloads, containers, or desktop usage. As a DevOps/SRE, you'll encounter multiple distros, so it’s important to know where each fits.&lt;/p&gt;
&lt;h3&gt;
  
  
  🔹 Common Distros &amp;amp; Their Use Cases
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F59v6e3d1rse1eckmtc2e.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%2F59v6e3d1rse1eckmtc2e.png" alt="Dirrerent Linux Distros" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example in Real Work:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you spin up an AWS EC2 instance, you'll often see &lt;strong&gt;Amazon Linux&lt;/strong&gt; as default.&lt;/li&gt;
&lt;li&gt;If you work in an enterprise with strict compliance, they'll likely use &lt;strong&gt;RHEL&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If you're practicing as a beginner, &lt;strong&gt;Ubuntu&lt;/strong&gt; is the most friendly starting point.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;📚 Files &amp;amp; Directories in Linux&lt;/strong&gt;
&lt;/h2&gt;


&lt;h3&gt;
  
  
  &lt;strong&gt;What is a Filesystem?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A filesystem is how an operating system &lt;strong&gt;organizes and stores data on disk&lt;/strong&gt;. In Linux, &lt;strong&gt;everything is a file&lt;/strong&gt; — regular files, directories, devices, sockets, even processes.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/dev/sda&lt;/code&gt; → your disk is treated like a file&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/proc/cpuinfo&lt;/code&gt; → your CPU info is a file&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  &lt;strong&gt;Linux Directory Hierarchy&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/                  → Root directory (everything starts here)
├── bin/           → Essential user binaries
│   ├── ls         # list files
│   ├── cp         # copy files
│   └── mv         # move/rename files
├── boot/          → Bootloader &amp;amp; kernel files
│   ├── vmlinuz    # Linux kernel image
│   ├── initrd.img # initial RAM disk for boot
│   └── grub/      # GRUB bootloader configs
├── dev/           → Device files (hardware abstraction)
│   ├── sda        # disk drives
│   ├── tty        # terminals
│   └── null       # null device
├── etc/           → System configuration files
│   ├── passwd     # user accounts
│   ├── shadow     # encrypted passwords
│   ├── group      # group definitions
│   ├── ssh/       # SSH server configs
│   └── nginx/     # web server configs
├── home/          → Home directories for regular users
│   ├── alice/     # user alice's data
│   └── bob/       # user bob's data
├── lib/           → Shared libraries
│   ├── libpthread.so.0 # threading library
│   └── libm.so        # math library
├── media/         → Mount points for removable media
│   └── usb/       # USB mount point
├── mnt/           → Temporary mount points
│   └── iso/       # mounted ISO images
├── opt/           → Optional/third-party software
│   └── docker/    # docker installation files
├── proc/          → Virtual filesystem for kernel &amp;amp; processes
│   ├── cpuinfo    # CPU details
│   ├── meminfo    # Memory details
│   └── 1234/      # process info (PID 1234)
├── root/          → Home directory for root user
├── sbin/          → System binaries (admin tasks)
│   ├── shutdown   # shutdown server
│   ├── mount      # mount/unmount filesystems
│   └── ifconfig   # network configuration (older)
├── tmp/           → Temporary files (cleared on reboot)
├── usr/           → User programs &amp;amp; libraries
│   ├── bin/       # non-essential binaries
│   ├── lib/       # libraries
│   ├── include/   # header files for compilation
│   └── share/     # shared resources (docs, man pages)
└── var/           → Variable data
    ├── log/       # system logs
    │   ├── syslog # general logs
    │   └── auth.log # authentication logs
    ├── spool/     # mail &amp;amp; print queues
    └── cache/     # cached data for apps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Explanation &amp;amp; Best Practices for Each Directory&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/bin – Essential user commands&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Commands every user needs, even in single-user mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Don’t add custom binaries here; use &lt;code&gt;/usr/local/bin/&lt;/code&gt; instead.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/boot – Boot files&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Kernel images, bootloader configs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Only modify with caution. Backup configs before upgrading kernels.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/dev – Devices&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Represents hardware devices as files (e.g., &lt;code&gt;/dev/sda&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Never edit these files directly; use tools like &lt;code&gt;mount&lt;/code&gt; or &lt;code&gt;fdisk&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/etc – Configurations&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Central place for system &amp;amp; application configs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Backup before editing; version-control configs if possible.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/home – User data&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Personal files, scripts, and workspace for users.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Limit sensitive data in home dirs; backup regularly.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/lib – Libraries&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Required by binaries in &lt;code&gt;/bin&lt;/code&gt; and &lt;code&gt;/sbin&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Don’t manually delete libraries; use package managers.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/media &amp;amp; /mnt – Mount points&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Temporary or removable storage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Unmount devices after use to avoid data corruption.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/opt – Optional software&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Third-party software installations (Docker, Oracle, custom software).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Install large apps here to avoid cluttering &lt;code&gt;/usr/bin&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/proc – Virtual filesystem&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Access kernel and process info.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Read-only; don’t try to write files here (except for tuning like &lt;code&gt;/proc/sys&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/root – Root home&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Admin user workspace.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Don’t store scripts for multiple users here.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/sbin – System binaries&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Commands for system administration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Use &lt;code&gt;sudo&lt;/code&gt; to run commands; don’t add personal scripts.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/tmp – Temporary files&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Scratch files, temporary data for apps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Avoid storing important data; auto-cleared on reboot.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/usr – User programs &amp;amp; resources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Non-essential binaries, libraries, documentation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Don’t modify manually; use package managers.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;/var – Variable data&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use:&lt;/strong&gt; Logs, caches, print/mail spools.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best practice:&lt;/strong&gt; Rotate logs regularly (&lt;code&gt;logrotate&lt;/code&gt;) and monitor disk usage (&lt;code&gt;du&lt;/code&gt;/&lt;code&gt;df&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Linux File &amp;amp; Directory Commands — DevOps/SRE Cheat Sheet&lt;/strong&gt;
&lt;/h2&gt;


&lt;h3&gt;
  
  
  1. &lt;strong&gt;Create, Update, Delete Files&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;file.txt                    &lt;span class="c"&gt;# Create an empty file&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="o"&gt;&amp;gt;&lt;/span&gt; file.txt     &lt;span class="c"&gt;# Create file with content (overwrite if exists)&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Append this line"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; file.txt  &lt;span class="c"&gt;# Append content to file&lt;/span&gt;
&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; newfile.txt                  &lt;span class="c"&gt;# Create file and type content (Ctrl+D to save)&lt;/span&gt;
&lt;span class="nb"&gt;rm &lt;/span&gt;file.txt                        &lt;span class="c"&gt;# Delete a file&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; file.txt                     &lt;span class="c"&gt;# Delete with interactive prompt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Directories — Create, Delete, Navigate&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;mydir                        &lt;span class="c"&gt;# Create directory&lt;/span&gt;
&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; parent/child/grand        &lt;span class="c"&gt;# Create nested directories&lt;/span&gt;
&lt;span class="nb"&gt;rmdir &lt;/span&gt;emptydir                      &lt;span class="c"&gt;# Remove empty directory&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; mydir                        &lt;span class="c"&gt;# Remove non-empty directory recursively&lt;/span&gt;

&lt;span class="nb"&gt;pwd&lt;/span&gt;                                 &lt;span class="c"&gt;# Print current directory&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /path/to/dir                      &lt;span class="c"&gt;# Change directory&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ~                                 &lt;span class="c"&gt;# Go to home directory&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; -                                 &lt;span class="c"&gt;# Go to previous directory&lt;/span&gt;

&lt;span class="nb"&gt;ls&lt;/span&gt;                                   &lt;span class="c"&gt;# List files in current directory&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt;                                &lt;span class="c"&gt;# List with detailed info (permissions, owner, size)&lt;/span&gt;
&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-a&lt;/span&gt;                                &lt;span class="c"&gt;# List including hidden files&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Copy, Move, Rename&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cp &lt;/span&gt;file.txt /backup/                 &lt;span class="c"&gt;# Copy file to another location&lt;/span&gt;
&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; mydir /backup/                 &lt;span class="c"&gt;# Copy directory recursively&lt;/span&gt;
&lt;span class="nb"&gt;mv &lt;/span&gt;file.txt newfile.txt               &lt;span class="c"&gt;# Rename a file&lt;/span&gt;
&lt;span class="nb"&gt;mv &lt;/span&gt;file.txt /new/path/                &lt;span class="c"&gt;# Move file to new location&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Permissions &amp;amp; Metadata&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; file.txt                        &lt;span class="c"&gt;# Show permissions, owner, size, modification time&lt;/span&gt;
&lt;span class="nb"&gt;stat &lt;/span&gt;file.txt                          &lt;span class="c"&gt;# Detailed metadata of file&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;644 file.txt                     &lt;span class="c"&gt;# Set permissions (owner=r/w, group/others=r)&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x script.sh                     &lt;span class="c"&gt;# Make file executable&lt;/span&gt;
&lt;span class="nb"&gt;chown &lt;/span&gt;user:group file.txt              &lt;span class="c"&gt;# Change owner and group&lt;/span&gt;
&lt;span class="nb"&gt;umask&lt;/span&gt;                                  &lt;span class="c"&gt;# Show default permission mask&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Disk Usage &amp;amp; Space&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt;                                   &lt;span class="c"&gt;# Show disk usage per filesystem (human-readable)&lt;/span&gt;
&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-sh&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;                                 &lt;span class="c"&gt;# Show size of files/directories in current folder&lt;/span&gt;
&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-sh&lt;/span&gt; /var/log/&lt;span class="k"&gt;*&lt;/span&gt;                        &lt;span class="c"&gt;# Find size of logs&lt;/span&gt;
&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-ah&lt;/span&gt; /home/ubuntu/ | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-rh&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-10&lt;/span&gt;  &lt;span class="c"&gt;# Top 10 largest files/directories&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;Search Files &amp;amp; Content&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find /var/log &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"*.log"&lt;/span&gt;            &lt;span class="c"&gt;# Find all .log files&lt;/span&gt;
find /home &lt;span class="nt"&gt;-type&lt;/span&gt; f &lt;span class="nt"&gt;-size&lt;/span&gt; +100M         &lt;span class="c"&gt;# Find files larger than 100MB&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"error"&lt;/span&gt; file.txt                   &lt;span class="c"&gt;# Search for "error" inside a file&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"timeout"&lt;/span&gt; /etc/nginx/ &lt;span class="nt"&gt;-r&lt;/span&gt;       &lt;span class="c"&gt;# Recursive search, case-insensitive&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="s2"&gt;"failed"&lt;/span&gt; /var/log/auth.log | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $1, $2, $5}'&lt;/span&gt;  &lt;span class="c"&gt;# Extract date &amp;amp; user&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  7. &lt;strong&gt;Archiving &amp;amp; Syncing&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-czvf&lt;/span&gt; archive.tar.gz /path/to/dir         &lt;span class="c"&gt;# Compress directory into tar.gz&lt;/span&gt;
&lt;span class="nb"&gt;tar&lt;/span&gt; &lt;span class="nt"&gt;-xzvf&lt;/span&gt; archive.tar.gz &lt;span class="nt"&gt;-C&lt;/span&gt; /restore/         &lt;span class="c"&gt;# Extract archive to target folder&lt;/span&gt;
rsync &lt;span class="nt"&gt;-av&lt;/span&gt; /source/ /destination/              &lt;span class="c"&gt;# Sync directories recursively (preserve attributes)&lt;/span&gt;
rsync &lt;span class="nt"&gt;-av&lt;/span&gt; &lt;span class="nt"&gt;--dry-run&lt;/span&gt; /source/ /destination/    &lt;span class="c"&gt;# Test sync without making changes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Linux Processes &amp;amp; Services&lt;/strong&gt;
&lt;/h2&gt;


&lt;h3&gt;
  
  
  &lt;strong&gt;Processes&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;process&lt;/strong&gt; is any running program in Linux. Every command you execute, every script, and every daemon is a process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;br&gt;
Processes consume CPU, memory, and other system resources. Monitoring them helps prevent &lt;strong&gt;crashes, high CPU usage, and memory leaks&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Services (Daemons)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;service&lt;/strong&gt; is a long-running background process that provides a specific function, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web server → &lt;code&gt;nginx&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Database → &lt;code&gt;mysql&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Monitoring agent → &lt;code&gt;prometheus&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;br&gt;
Services ensure your applications, monitoring, and infrastructure run &lt;strong&gt;continuously&lt;/strong&gt; without manual intervention.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. &lt;strong&gt;Process Monitoring with &lt;code&gt;ps&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps                       &lt;span class="c"&gt;# List processes for current shell&lt;/span&gt;
ps &lt;span class="nt"&gt;-ef&lt;/span&gt;                    &lt;span class="c"&gt;# Full list of all processes&lt;/span&gt;
ps aux                    &lt;span class="c"&gt;# Alternative format showing user, CPU, memory&lt;/span&gt;
ps &lt;span class="nt"&gt;-u&lt;/span&gt; ubuntu              &lt;span class="c"&gt;# Show processes by user 'ubuntu'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Check if a service is running after a failure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps &lt;span class="nt"&gt;-ef&lt;/span&gt; | &lt;span class="nb"&gt;grep &lt;/span&gt;nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Helps identify if the process crashed or didn’t start.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Real-time Process Monitoring with &lt;code&gt;top&lt;/code&gt; / &lt;code&gt;htop&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;top                       &lt;span class="c"&gt;# Interactive real-time process viewer&lt;/span&gt;
htop                      &lt;span class="c"&gt;# Enhanced interactive view (if installed)&lt;/span&gt;
top &lt;span class="nt"&gt;-u&lt;/span&gt; ubuntu             &lt;span class="c"&gt;# Show processes for specific user&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
CPU spike alert: &lt;code&gt;top&lt;/code&gt; shows which process is consuming CPU → investigate memory leaks or runaway processes.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. &lt;strong&gt;Managing Process Priority (&lt;code&gt;nice&lt;/code&gt; / &lt;code&gt;renice&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;nice&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 10 ./backup.sh     &lt;span class="c"&gt;# Start process with lower priority (10)&lt;/span&gt;
renice &lt;span class="nt"&gt;-n&lt;/span&gt; 5 &lt;span class="nt"&gt;-p&lt;/span&gt; 1234        &lt;span class="c"&gt;# Change priority of PID 1234 to 5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
During high-load on production, lower priority of non-critical scripts so main services remain responsive.&lt;/p&gt;
&lt;h3&gt;
  
  
  4. &lt;strong&gt;Tracing Process Calls (&lt;code&gt;strace&lt;/code&gt; / &lt;code&gt;ltrace&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;strace &lt;span class="nt"&gt;-p&lt;/span&gt; 1234                 &lt;span class="c"&gt;# Trace system calls of PID 1234&lt;/span&gt;
strace &lt;span class="nt"&gt;-o&lt;/span&gt; output.log &lt;span class="nt"&gt;-p&lt;/span&gt; 1234   &lt;span class="c"&gt;# Save trace output to file&lt;/span&gt;
ltrace ./app                   &lt;span class="c"&gt;# Trace library calls of a binary&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Identify why a program fails to open a file → &lt;code&gt;strace&lt;/code&gt; shows "Permission denied" or missing library.&lt;/p&gt;
&lt;h3&gt;
  
  
  5. &lt;strong&gt;Service Management (&lt;code&gt;systemctl&lt;/code&gt; / &lt;code&gt;service&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl status nginx                  &lt;span class="c"&gt;# Check status of nginx service&lt;/span&gt;
systemctl start nginx                   &lt;span class="c"&gt;# Start service&lt;/span&gt;
systemctl stop nginx                    &lt;span class="c"&gt;# Stop service&lt;/span&gt;
systemctl restart nginx                 &lt;span class="c"&gt;# Restart service&lt;/span&gt;
systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;nginx                  &lt;span class="c"&gt;# Enable service at boot&lt;/span&gt;
systemctl disable nginx                 &lt;span class="c"&gt;# Disable service at boot&lt;/span&gt;
systemctl list-units &lt;span class="nt"&gt;--type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;service    &lt;span class="c"&gt;# List all active services&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
After deployment, nginx not serving pages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl status nginx
journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; nginx &lt;span class="nt"&gt;-b&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Shows logs and reasons why it failed to start.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;Log Analysis with &lt;code&gt;journalctl&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;journalctl                           &lt;span class="c"&gt;# View all system logs&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; nginx                  &lt;span class="c"&gt;# Logs for specific service&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-f&lt;/span&gt;                         &lt;span class="c"&gt;# Follow logs in real-time (like tail -f)&lt;/span&gt;
journalctl &lt;span class="nt"&gt;--since&lt;/span&gt; &lt;span class="s2"&gt;"2 hours ago"&lt;/span&gt;     &lt;span class="c"&gt;# Logs from last 2 hours&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-p&lt;/span&gt; err                     &lt;span class="c"&gt;# Only show error-level logs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Troubleshooting system boot failures:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;journalctl &lt;span class="nt"&gt;-b&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; err
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Displays errors only from the last boot.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Best Practices for Processes &amp;amp; Services&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Always &lt;strong&gt;check logs first&lt;/strong&gt; with &lt;code&gt;journalctl&lt;/code&gt; before restarting services.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;systemctl enable&lt;/code&gt; for &lt;strong&gt;critical services&lt;/strong&gt; to auto-start after reboot.&lt;/li&gt;
&lt;li&gt;Monitor resource usage (&lt;code&gt;top&lt;/code&gt;, &lt;code&gt;htop&lt;/code&gt;) to detect &lt;strong&gt;runaway processes&lt;/strong&gt; early.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;strace&lt;/code&gt; / &lt;code&gt;ltrace&lt;/code&gt; for &lt;strong&gt;deep debugging&lt;/strong&gt; only when necessary (CPU intensive).&lt;/li&gt;
&lt;li&gt;Prioritize scripts with &lt;code&gt;nice&lt;/code&gt; to &lt;strong&gt;avoid disrupting production workloads&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Linux Networking — DevOps/SRE Cheat Sheet&lt;/strong&gt;
&lt;/h2&gt;




&lt;h3&gt;
  
  
  1. &lt;strong&gt;What is Networking in Linux?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Networking is how computers and devices communicate over a network (LAN, WAN, or the Internet).&lt;/p&gt;

&lt;p&gt;Linux networking involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Interfaces&lt;/strong&gt; (eth0, ens33, etc.)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IP addresses&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Ports &amp;amp; protocols&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Routing tables&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it matters for DevOps/SRE:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Troubleshooting connectivity issues&lt;/li&gt;
&lt;li&gt;Monitoring network traffic and latency&lt;/li&gt;
&lt;li&gt;Ensuring services are reachable and secure&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;IP Address and Interface Management (&lt;code&gt;ip&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ip addr show                          &lt;span class="c"&gt;# Show all network interfaces and IP addresses&lt;/span&gt;
ip &lt;span class="nb"&gt;link &lt;/span&gt;show                          &lt;span class="c"&gt;# Show interface details (up/down, MTU)&lt;/span&gt;
ip route show                          &lt;span class="c"&gt;# Show routing table&lt;/span&gt;
ip addr add 192.168.1.10/24 dev eth0  &lt;span class="c"&gt;# Assign IP to interface&lt;/span&gt;
ip &lt;span class="nb"&gt;link set &lt;/span&gt;eth0 up                     &lt;span class="c"&gt;# Bring interface up&lt;/span&gt;
ip &lt;span class="nb"&gt;link set &lt;/span&gt;eth0 down                   &lt;span class="c"&gt;# Bring interface down&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Output shows your server's network interfaces and assigned IPs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Socket Statistics (&lt;code&gt;ss&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ss &lt;span class="nt"&gt;-tuln&lt;/span&gt;        &lt;span class="c"&gt;# Show listening TCP/UDP ports with numeric info&lt;/span&gt;
ss &lt;span class="nt"&gt;-s&lt;/span&gt;           &lt;span class="c"&gt;# Summary of socket connections&lt;/span&gt;
ss &lt;span class="nt"&gt;-p&lt;/span&gt;           &lt;span class="c"&gt;# Show process using each socket&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Shows which ports are open and which services are listening.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Legacy Network Connections (&lt;code&gt;netstat&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;netstat &lt;span class="nt"&gt;-tuln&lt;/span&gt;    &lt;span class="c"&gt;# Show active TCP/UDP ports (similar to ss)&lt;/span&gt;
netstat &lt;span class="nt"&gt;-rn&lt;/span&gt;      &lt;span class="c"&gt;# Show routing table&lt;/span&gt;
netstat &lt;span class="nt"&gt;-p&lt;/span&gt;       &lt;span class="c"&gt;# Show PID of processes using ports&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Lists active ports and listening services.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Network Requests (&lt;code&gt;curl&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://example.com       &lt;span class="c"&gt;# Fetch HTTP response from URL&lt;/span&gt;
curl &lt;span class="nt"&gt;-I&lt;/span&gt; http://example.com    &lt;span class="c"&gt;# Show only HTTP headers&lt;/span&gt;
curl &lt;span class="nt"&gt;-v&lt;/span&gt; http://example.com    &lt;span class="c"&gt;# Verbose output with connection info&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-I&lt;/span&gt; https://google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Checks HTTP headers to verify connectivity and response.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;DNS Queries (&lt;code&gt;dig&lt;/code&gt; / &lt;code&gt;nslookup&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig example.com        &lt;span class="c"&gt;# Get DNS records for domain&lt;/span&gt;
dig A example.com      &lt;span class="c"&gt;# Get A record (IP)&lt;/span&gt;
dig MX example.com     &lt;span class="c"&gt;# Get mail server records&lt;/span&gt;
nslookup example.com   &lt;span class="c"&gt;# Alternative to dig&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Shows IP addresses and DNS info for Google.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  7. &lt;strong&gt;Network Path Tracing (&lt;code&gt;traceroute&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;traceroute example.com       &lt;span class="c"&gt;# Trace path packets take to destination&lt;/span&gt;
traceroute &lt;span class="nt"&gt;-n&lt;/span&gt; example.com    &lt;span class="c"&gt;# Numeric IP only, skip DNS resolution&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;traceroute github.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Shows each hop from your server to GitHub, useful for latency analysis.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  8. &lt;strong&gt;Packet Capture (&lt;code&gt;tcpdump&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tcpdump &lt;span class="nt"&gt;-i&lt;/span&gt; eth0             &lt;span class="c"&gt;# Capture all packets on interface eth0&lt;/span&gt;
tcpdump &lt;span class="nt"&gt;-i&lt;/span&gt; eth0 port 80     &lt;span class="c"&gt;# Capture HTTP traffic&lt;/span&gt;
tcpdump &lt;span class="nt"&gt;-i&lt;/span&gt; eth0 &lt;span class="nt"&gt;-nn&lt;/span&gt;         &lt;span class="c"&gt;# Numeric addresses, no DNS resolution&lt;/span&gt;
tcpdump &lt;span class="nt"&gt;-r&lt;/span&gt; capture.pcap     &lt;span class="c"&gt;# Read previously saved capture file&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;tcpdump &lt;span class="nt"&gt;-i&lt;/span&gt; eth0 port 22
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Monitors SSH traffic for troubleshooting connection issues.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Linux Users, Groups &amp;amp; Permissions — DevOps/SRE Guide&lt;/strong&gt;
&lt;/h2&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;Users&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;user&lt;/strong&gt; is any person or system entity that can log in to Linux.&lt;br&gt;
Each user has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Username&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Password&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Home directory&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permissions&lt;/strong&gt; defining what they can access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;alice&lt;/code&gt;, &lt;code&gt;root&lt;/code&gt;, &lt;code&gt;ubuntu&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Groups&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;group&lt;/strong&gt; is a collection of users.&lt;br&gt;
Assigning permissions to groups &lt;strong&gt;simplifies access control&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; &lt;code&gt;sudo&lt;/code&gt;, &lt;code&gt;devops&lt;/code&gt;, &lt;code&gt;docker&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Permissions&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Linux uses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Read (r)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Write (w)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Execute (x)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are applied to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Owner&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Group&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Others&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it matters for DevOps/SRE:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Control access to sensitive files (&lt;code&gt;/etc&lt;/code&gt;, &lt;code&gt;/var/log&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Ensure only authorized users run scripts or manage services&lt;/li&gt;
&lt;li&gt;Enforce security best practices via &lt;strong&gt;least privilege&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;1. User Management (&lt;code&gt;useradd&lt;/code&gt;, &lt;code&gt;adduser&lt;/code&gt;, &lt;code&gt;usermod&lt;/code&gt;, &lt;code&gt;userdel&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;useradd alice                &lt;span class="c"&gt;# Create new user 'alice'&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;adduser alice                &lt;span class="c"&gt;# Alternative way to create 'alice'&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;passwd alice                 &lt;span class="c"&gt;# Set password for 'alice'&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;usermod &lt;span class="nt"&gt;-aG&lt;/span&gt; &lt;span class="nb"&gt;sudo &lt;/span&gt;alice       &lt;span class="c"&gt;# Add 'alice' to 'sudo' group&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;userdel &lt;span class="nt"&gt;-r&lt;/span&gt; olduser           &lt;span class="c"&gt;# Delete user 'olduser' and remove home dir&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


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

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Creates user &lt;code&gt;john&lt;/code&gt;, sets a password, and adds him to the &lt;code&gt;docker&lt;/code&gt; group.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Group Management (&lt;code&gt;groupadd&lt;/code&gt;, &lt;code&gt;gpasswd&lt;/code&gt;, &lt;code&gt;groups&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;groupadd devops             &lt;span class="c"&gt;# Create group 'devops'&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;gpasswd &lt;span class="nt"&gt;-a&lt;/span&gt; alice devops     &lt;span class="c"&gt;# Add 'alice' to group&lt;/span&gt;
&lt;span class="nb"&gt;groups &lt;/span&gt;alice                      &lt;span class="c"&gt;# Show groups 'alice' belongs to&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;gpasswd &lt;span class="nt"&gt;-d&lt;/span&gt; alice devops     &lt;span class="c"&gt;# Remove 'alice' from group&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;groupadd monitoring
&lt;span class="nb"&gt;sudo &lt;/span&gt;gpasswd &lt;span class="nt"&gt;-a&lt;/span&gt; john monitoring
&lt;span class="nb"&gt;groups &lt;/span&gt;john
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Manages access for multiple users to shared resources (logs, scripts, etc.).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. File &amp;amp; Directory Permissions (&lt;code&gt;chmod&lt;/code&gt;, &lt;code&gt;chown&lt;/code&gt;, &lt;code&gt;chgrp&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; file.txt                   &lt;span class="c"&gt;# View permissions, owner, group&lt;/span&gt;
&lt;span class="nb"&gt;chmod &lt;/span&gt;644 file.txt               &lt;span class="c"&gt;# rw-r--r-- → owner=read/write, others=read&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x script.sh               &lt;span class="c"&gt;# Make script executable&lt;/span&gt;
&lt;span class="nb"&gt;chown &lt;/span&gt;alice:devops file.txt      &lt;span class="c"&gt;# Change owner to 'alice' and group to 'devops'&lt;/span&gt;
&lt;span class="nb"&gt;chgrp &lt;/span&gt;devops file.txt            &lt;span class="c"&gt;# Change only the group&lt;/span&gt;
&lt;span class="nb"&gt;umask &lt;/span&gt;002                        &lt;span class="c"&gt;# Default permission mask for new files&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod &lt;/span&gt;755 /home/alice/scripts/deploy.sh
&lt;span class="nb"&gt;chown &lt;/span&gt;alice:devops /var/log/myapp.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Ensures only authorized users can execute scripts or read/write logs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. Password Management (&lt;code&gt;passwd&lt;/code&gt;, &lt;code&gt;chage&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;passwd alice               &lt;span class="c"&gt;# Change password&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;passwd &lt;span class="nt"&gt;-l&lt;/span&gt; alice            &lt;span class="c"&gt;# Lock user account&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;passwd &lt;span class="nt"&gt;-u&lt;/span&gt; alice            &lt;span class="c"&gt;# Unlock user account&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;chage &lt;span class="nt"&gt;-l&lt;/span&gt; alice             &lt;span class="c"&gt;# View password expiry&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;chage &lt;span class="nt"&gt;-M&lt;/span&gt; 90 alice          &lt;span class="c"&gt;# Force password expiry every 90 days&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;passwd &lt;span class="nt"&gt;-l&lt;/span&gt; john              &lt;span class="c"&gt;# Temporarily lock user&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;chage &lt;span class="nt"&gt;-M&lt;/span&gt; 60 john            &lt;span class="c"&gt;# Force password rotation every 60 days&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Helps maintain &lt;strong&gt;security best practices&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;5. Sudo Access &amp;amp; Safety (&lt;code&gt;sudoers&lt;/code&gt;)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;visudo                      &lt;span class="c"&gt;# Edit sudoers safely&lt;/span&gt;
alice &lt;span class="nv"&gt;ALL&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;ALL&lt;span class="o"&gt;)&lt;/span&gt; NOPASSWD:ALL     &lt;span class="c"&gt;# Give 'alice' passwordless sudo&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Best Practice:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Always use &lt;code&gt;visudo&lt;/code&gt; to prevent syntax errors.&lt;/li&gt;
&lt;li&gt;Limit sudo access to &lt;strong&gt;essential users only&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Best Practices for Users &amp;amp; Permissions&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Principle of Least Privilege:&lt;/strong&gt; Only give users the access they need.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Groups for Shared Access:&lt;/strong&gt; Use groups instead of giving sudo/root access.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secure Sensitive Files:&lt;/strong&gt; Limit access to logs, configs, and scripts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use umask and chmod wisely:&lt;/strong&gt; Ensure new files have proper permissions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audit regularly:&lt;/strong&gt; Check &lt;code&gt;/etc/passwd&lt;/code&gt;, &lt;code&gt;/etc/group&lt;/code&gt;, &lt;code&gt;/etc/sudoers&lt;/code&gt; for anomalies.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Logs in Linux — DevOps/SRE Guide&lt;/strong&gt;
&lt;/h2&gt;




&lt;p&gt;Logs are &lt;strong&gt;records of events, activities, or messages&lt;/strong&gt; generated by the system, applications, and services. They help in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Monitoring system health&lt;/li&gt;
&lt;li&gt;Debugging issues&lt;/li&gt;
&lt;li&gt;Auditing actions&lt;/li&gt;
&lt;li&gt;Performing Root Cause Analysis (RCA)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Logs are essential for DevOps/SRE engineers to &lt;strong&gt;detect incidents&lt;/strong&gt;, &lt;strong&gt;understand system behavior&lt;/strong&gt;, and &lt;strong&gt;resolve problems quickly&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Linux stores logs in &lt;strong&gt;plain text files&lt;/strong&gt;, making them easy to &lt;strong&gt;read, search, and process&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1. Systemd Logs — &lt;code&gt;journalctl&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;journalctl&lt;/code&gt; is used to view logs managed by &lt;strong&gt;systemd&lt;/strong&gt; (modern Linux systems).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; nginx &lt;span class="nt"&gt;--since&lt;/span&gt; &lt;span class="s2"&gt;"1 hour ago"&lt;/span&gt;  &lt;span class="c"&gt;# Logs for nginx from last hour&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-f&lt;/span&gt;                             &lt;span class="c"&gt;# Follow logs in real-time&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-b&lt;/span&gt;                             &lt;span class="c"&gt;# Logs since last boot&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-p&lt;/span&gt; err                          &lt;span class="c"&gt;# Show only error-level logs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; nginx &lt;span class="nt"&gt;--since&lt;/span&gt; &lt;span class="s2"&gt;"1 hour ago"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Displays logs for the nginx service from the last hour, useful for &lt;strong&gt;real-time debugging&lt;/strong&gt; or checking recent service failures.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Traditional Log Files — &lt;code&gt;/var/log&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Linux stores logs in &lt;code&gt;/var/log&lt;/code&gt;. Common logs include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/var/log/syslog&lt;/code&gt; → general system logs&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/var/log/messages&lt;/code&gt; → important system messages&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/var/log/auth.log&lt;/code&gt; → authentication logs&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;/var/log/nginx/&lt;/code&gt; → web server logs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example commands:&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;less /var/log/syslog                 &lt;span class="c"&gt;# Scroll through system logs&lt;/span&gt;
&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /var/log/nginx/access.log   &lt;span class="c"&gt;# Monitor nginx access logs in real-time&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;less&lt;/code&gt; → scrollable output, &lt;code&gt;tail -f&lt;/code&gt; → real-time monitoring.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Log Rotation — &lt;code&gt;logrotate&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Logs grow over time and can fill up disk space.&lt;br&gt;
&lt;strong&gt;Solution:&lt;/strong&gt; &lt;code&gt;logrotate&lt;/code&gt; automatically rotates, compresses, and deletes old logs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example &lt;code&gt;/etc/logrotate.d/nginx&lt;/code&gt; snippet:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/var/log/nginx/*.log {
    daily
    rotate 14
    compress
    missingok
    notifempty
    create 0640 www-data adm
    sharedscripts
    postrotate
        systemctl reload nginx
    endscript
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Rotates nginx logs &lt;strong&gt;daily&lt;/strong&gt;, keeps &lt;strong&gt;14 old copies&lt;/strong&gt;, compresses them, and reloads the service after rotation.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4. Searching &amp;amp; Filtering Logs&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Use &lt;strong&gt;grep pipelines&lt;/strong&gt; to quickly find relevant entries:&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;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; error /var/log/app.log | less       &lt;span class="c"&gt;# Search "error" in logs&lt;/span&gt;
&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nb"&gt;timeout&lt;/span&gt; /var/log/nginx/error.log   &lt;span class="c"&gt;# Search "timeout" in nginx error log&lt;/span&gt;
&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /var/log/syslog | &lt;span class="nb"&gt;grep &lt;/span&gt;CRON        &lt;span class="c"&gt;# Real-time monitoring for cron jobs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-i&lt;/code&gt; → case-insensitive&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;| less&lt;/code&gt; → scrollable output&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Combine &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;awk&lt;/code&gt;, &lt;code&gt;tail&lt;/code&gt; for &lt;strong&gt;efficient log analysis&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Best Practices for Logs&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Centralize logs:&lt;/strong&gt; Use ELK Stack (Elasticsearch, Logstash, Kibana) or Prometheus + Grafana.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rotate &amp;amp; compress logs:&lt;/strong&gt; Save disk space and prevent storage issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filter &amp;amp; analyze efficiently:&lt;/strong&gt; Use &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;awk&lt;/code&gt;, and pipelines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitor critical logs in real-time:&lt;/strong&gt; Detect incidents proactively.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Package Management &amp;amp; Updates — DevOps/SRE Guide&lt;/strong&gt;
&lt;/h2&gt;




&lt;h3&gt;
  
  
  &lt;strong&gt;What is Package Management?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Package management is the process of &lt;strong&gt;installing, updating, removing, and maintaining software&lt;/strong&gt; on a Linux system.&lt;br&gt;
Linux uses package managers to automate software handling instead of manually downloading binaries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it matters for DevOps/SRE:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Keep servers &lt;strong&gt;up-to-date and secure&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Install essential tools and dependencies &lt;strong&gt;consistently&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Automate &lt;strong&gt;patching and deployments&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;1. Debian/Ubuntu — &lt;code&gt;apt&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update                &lt;span class="c"&gt;# Update package index (repo info)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt upgrade               &lt;span class="c"&gt;# Upgrade all installed packages&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;nginx         &lt;span class="c"&gt;# Install a package (nginx web server)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt remove nginx          &lt;span class="c"&gt;# Remove package but keep config files&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt purge nginx           &lt;span class="c"&gt;# Remove package + config files&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt search docker         &lt;span class="c"&gt;# Search for a package&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt show nginx            &lt;span class="c"&gt;# Show package details&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;htop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Updates repo info and installs &lt;code&gt;htop&lt;/code&gt; for process monitoring.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. RHEL/CentOS/Fedora — &lt;code&gt;yum&lt;/code&gt; / &lt;code&gt;dnf&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;YUM:&lt;/strong&gt; Traditional package manager&lt;br&gt;
&lt;strong&gt;DNF:&lt;/strong&gt; Newer, faster replacement in Fedora/RHEL 8+&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commands (YUM):&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;&lt;span class="nb"&gt;sudo &lt;/span&gt;yum update                &lt;span class="c"&gt;# Update all packages&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;httpd         &lt;span class="c"&gt;# Install Apache web server&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;yum remove httpd          &lt;span class="c"&gt;# Remove Apache&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;yum search nginx          &lt;span class="c"&gt;# Search for a package&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;yum info nginx            &lt;span class="c"&gt;# Show package info&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Commands (DNF):&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;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf update                &lt;span class="c"&gt;# Update all packages&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;nginx         &lt;span class="c"&gt;# Install nginx&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf remove nginx          &lt;span class="c"&gt;# Remove nginx&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf list installed        &lt;span class="c"&gt;# List all installed packages&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf repoquery nginx       &lt;span class="c"&gt;# Show package info from repo&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;git
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf remove nano
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Installs Git and removes nano editor.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3. Unattended / Automatic Updates&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Automatically patches the system without manual intervention — critical for &lt;strong&gt;production security&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ubuntu/Debian:&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;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;unattended-upgrades
&lt;span class="nb"&gt;sudo &lt;/span&gt;dpkg-reconfigure &lt;span class="nt"&gt;--priority&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;low unattended-upgrades
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Configures automatic security updates.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;RHEL/CentOS/Fedora:&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;&lt;span class="nb"&gt;sudo &lt;/span&gt;yum &lt;span class="nb"&gt;install &lt;/span&gt;yum-cron
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;--now&lt;/span&gt; yum-cron
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Enables automatic updates in the background.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Best Practices for Package Management&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Always update package index before installing:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf check-update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Prioritize &lt;strong&gt;security updates&lt;/strong&gt; on production servers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automate&lt;/strong&gt; package updates for multiple servers (Ansible, Puppet, or scripts).&lt;/li&gt;
&lt;li&gt;Keep a record of installed packages for auditing:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dpkg &lt;span class="nt"&gt;--get-selections&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; packages_list.txt    &lt;span class="c"&gt;# Debian/Ubuntu&lt;/span&gt;
rpm &lt;span class="nt"&gt;-qa&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; packages_list.txt                  &lt;span class="c"&gt;# RHEL/CentOS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Test updates in staging&lt;/strong&gt; before production to avoid downtime.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
   &lt;strong&gt;Linux Fundamentals Guide for DevOps/SRE&lt;/strong&gt; is  &lt;strong&gt;complete&lt;/strong&gt;, covering:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Linux Overview &amp;amp; File System&lt;/li&gt;
&lt;li&gt;File &amp;amp; Directory Commands&lt;/li&gt;
&lt;li&gt;Processes &amp;amp; Services&lt;/li&gt;
&lt;li&gt;Networking Commands&lt;/li&gt;
&lt;li&gt;Users, Groups &amp;amp; Permissions&lt;/li&gt;
&lt;li&gt;Logs&lt;/li&gt;
&lt;li&gt;Package Management &amp;amp; Updates&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>devops</category>
      <category>sre</category>
      <category>linux</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
