<?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: FARUKH KHAN</title>
    <description>The latest articles on DEV Community by FARUKH KHAN (@farukh166).</description>
    <link>https://dev.to/farukh166</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%2F1238733%2Fb4c7e9a8-c8e0-466c-b46d-c438db105e89.png</url>
      <title>DEV Community: FARUKH KHAN</title>
      <link>https://dev.to/farukh166</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/farukh166"/>
    <language>en</language>
    <item>
      <title>Mastering Bash Scripting: A Step-by-Step Guide 🚀</title>
      <dc:creator>FARUKH KHAN</dc:creator>
      <pubDate>Sun, 20 Oct 2024 13:43:01 +0000</pubDate>
      <link>https://dev.to/farukh166/mastering-bash-scripting-a-step-by-step-guide-3bkg</link>
      <guid>https://dev.to/farukh166/mastering-bash-scripting-a-step-by-step-guide-3bkg</guid>
      <description>&lt;p&gt;Bash scripting is a powerful tool for automating tasks and managing systems. Whether you're a sysadmin, developer, or DevOps engineer, understanding Bash scripts is crucial for your toolkit. In this post, we'll walk through several key tasks that highlight essential features of Bash. Let’s get scripting! 🖥️&lt;/p&gt;

&lt;h2&gt;
  
  
  Task 1: Comments 📝
&lt;/h2&gt;

&lt;p&gt;Comments make scripts easier to understand. They begin with # and are ignored during execution.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
# This script explains how comments work in Bash
&amp;lt;&amp;lt;comment
This script demonstrates the use of comments in Bash
Author: Farukh Khan
comment

echo "This is a script with comments."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x script.sh
./script.sh
&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 a script with comments.

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Task 2: Echo Command 📢
&lt;/h2&gt;

&lt;p&gt;The echo command is used to print messages to the terminal.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
echo "Hello, DevOps world! Ready to automate all the things?"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x script.sh
./script.sh
&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;Hello, DevOps world! Ready to automate all the things?

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Task 3: Variables 📊
&lt;/h2&gt;

&lt;p&gt;Variables store data in Bash. They can be used by simply referencing them with a $.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
greeting="Hello"
name="Farukh"
echo "$greeting, $name!"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x script.sh
./script.sh
&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;Hello, Farukh!

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Task 4: Arithmetic with Variables ➕🧮
&lt;/h2&gt;

&lt;p&gt;You can perform arithmetic with variables using $((...)).&lt;/p&gt;

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

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

# Taking input
echo "Enter first number:"
read num1
echo "Enter second number:"
read num2

# Calculating sum
sum=$((num1 + num2))

echo "The sum of $num1 and $num2 is $sum"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x script.sh
./script.sh
&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;Enter first number:
5
Enter second number:
10
The sum of 5 and 10 is 15
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Task 5: Built-in Variables 🔍
&lt;/h2&gt;

&lt;p&gt;Bash provides several built-in variables like $USER, $HOME, and $PWD.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
echo "User: $USER"
echo "Home Directory: $HOME"
echo "Current Directory: $PWD"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x script.sh
./script.sh
&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;User: ubuntu
Home Directory: /home/ubuntu
Current Directory: /home/ubuntu/scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Task 6: Wildcards for Pattern Matching 📂
&lt;/h2&gt;

&lt;p&gt;Wildcards such as * help match file patterns. Here, we list .txt files.&lt;/p&gt;

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

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

# List all .log files in the current directory
echo "Log files in this directory:"
ls *.log

# List all .sh files in the parent directory
echo "Bash scripts in the parent directory:"
ls ../*.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x script.sh
./script.sh
&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;Log files in this directory:
access.log
error.log
Bash scripts in the parent directory:
script.sh
backup.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Wrapping Up 🎁
&lt;/h2&gt;

&lt;p&gt;There you have it, folks! We've covered comments, echo, variables, arithmetic operations, built-in variables, and wildcards. These are the building blocks of Bash scripting that'll take your DevOps game to the next level.&lt;/p&gt;

&lt;p&gt;Remember, the key to mastering Bash (or any scripting language) is practice. So fire up that terminal and start coding! 💻&lt;/p&gt;

&lt;p&gt;Happy scripting, and may the DevOps force be with you! 🚀✨&lt;/p&gt;

&lt;h1&gt;
  
  
  DevOps #BashScripting #Automation #Linux #ShellScripting #DevOpsTools #ContinuousIntegration #ContinuousDeployment
&lt;/h1&gt;

</description>
    </item>
    <item>
      <title>Understanding Package Manager and Systemctl</title>
      <dc:creator>FARUKH KHAN</dc:creator>
      <pubDate>Fri, 18 Oct 2024 18:46:53 +0000</pubDate>
      <link>https://dev.to/farukh166/understanding-package-manager-and-systemctl-2d9o</link>
      <guid>https://dev.to/farukh166/understanding-package-manager-and-systemctl-2d9o</guid>
      <description>&lt;p&gt;Package management is a fundamental part of any DevOps workflow. Whether you’re deploying applications, managing servers, or automating processes, a strong understanding of Linux package managers is essential. In this post, we'll break down the key concepts of package managers and explore some practical tasks, including installing and managing essential tools like Docker and Jenkins. Let’s dive in!&lt;/p&gt;

&lt;h2&gt;
  
  
  🌐 Package Manager in Linux
&lt;/h2&gt;

&lt;p&gt;Simply put, a package manager is a tool that allows users to install, update, remove, and configure software on a Linux-based system. It handles packages, which are essentially software bundles. You can think of a package manager as the software's “delivery and maintenance” service.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features of Package Managers:
&lt;/h2&gt;

&lt;p&gt;Installation &amp;amp; Updates: Quickly install or update software packages.&lt;/p&gt;

&lt;p&gt;Dependency Management: Resolve and install software dependencies automatically.&lt;/p&gt;

&lt;p&gt;Configuration: Adjust package settings and configurations easily.&lt;/p&gt;

&lt;p&gt;Removal: Safely uninstall software while ensuring dependencies remain intact.&lt;/p&gt;

&lt;p&gt;Examples of common Linux package managers:&lt;/p&gt;

&lt;p&gt;Debian-based systems (Ubuntu): apt-get&lt;/p&gt;

&lt;p&gt;Red Hat-based systems (CentOS, Fedora):  yum, dnf&lt;/p&gt;

&lt;p&gt;Arch Linux: pacman&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ Package
&lt;/h2&gt;

&lt;p&gt;A package is more than just an application. It can include:&lt;/p&gt;

&lt;p&gt;GUI applications&lt;/p&gt;

&lt;p&gt;Command-line tools&lt;/p&gt;

&lt;p&gt;Libraries required by other software&lt;/p&gt;

&lt;p&gt;Each package typically comes as a compressed archive, including:&lt;/p&gt;

&lt;p&gt;Binary executables: The main software components.&lt;/p&gt;

&lt;p&gt;Configuration files: Essential for setup and operation.&lt;/p&gt;

&lt;p&gt;Metadata: Information about dependencies and updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  📦 Types of Linux Package Managers
&lt;/h2&gt;

&lt;p&gt;Different Linux distributions come with different package management systems. Even within the same ecosystem, you might have multiple package managers:&lt;/p&gt;

&lt;p&gt;Debian (DEB packages):  apt-get, aptitude&lt;/p&gt;

&lt;p&gt;RedHat (RPM packages):  yum, dnf&lt;/p&gt;

&lt;p&gt;Each of these tools helps in managing the lifecycle of software on your system—making it straightforward to install and maintain applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 Hands-On DevOps: Installing Docker &amp;amp; Jenkins
&lt;/h2&gt;

&lt;p&gt;Let’s now walk through installing Docker and Jenkins using package managers on both Ubuntu and CentOS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Docker &amp;amp; Jenkins on Ubuntu
&lt;/h2&gt;

&lt;p&gt;Ubuntu, being a Debian-based distribution, uses the APT package manager. Here’s how to install Docker and Jenkins:&lt;/p&gt;

&lt;p&gt;Installing Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install docker.io
sudo systemctl start docker
sudo systemctl enable docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Installing Jenkins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install openjdk-11-jdk -y
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ &amp;gt; /etc/apt/sources.list.d/jenkins.list'
sudo apt update
sudo apt install jenkins -y
sudo systemctl start jenkins
sudo systemctl enable jenkins
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Installing Docker &amp;amp; Jenkins on CentOS
&lt;/h2&gt;

&lt;p&gt;For CentOS, which is based on RedHat, you’ll use YUM or DNF as the package manager.&lt;/p&gt;

&lt;p&gt;Installing Docker:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum install docker
sudo systemctl start docker
sudo systemctl enable docker
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Installing Jenkins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum install java-11-openjdk
sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
sudo yum install jenkins
sudo systemctl start jenkins
sudo systemctl enable jenkins
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 Tip: Always check for the latest version of Docker and Jenkins to ensure you're installing the most stable and secure versions!&lt;/p&gt;

&lt;h2&gt;
  
  
  🔄 Managing Services with systemctl and service
&lt;/h2&gt;

&lt;p&gt;Now that Docker and Jenkins are installed, let’s manage their services using systemctl and service.&lt;/p&gt;

&lt;p&gt;Systemd and Systemctl&lt;/p&gt;

&lt;p&gt;Systemd is the system and service manager for most modern Linux distributions.&lt;/p&gt;

&lt;p&gt;Systemctl is the tool that interacts with Systemd to control services like Docker and Jenkins.&lt;/p&gt;

&lt;p&gt;Common systemctl commands:&lt;/p&gt;

&lt;p&gt;Check Docker Status: sudo systemctl status docker&lt;/p&gt;

&lt;p&gt;Stop Jenkins: sudo systemctl stop jenkins&lt;/p&gt;

&lt;p&gt;Alternatively, the service command can also be used:&lt;/p&gt;

&lt;p&gt;Check Docker Status: sudo service docker status&lt;/p&gt;

&lt;p&gt;Stop Jenkins: sudo service jenkins stop&lt;/p&gt;

&lt;h2&gt;
  
  
  ⚙️ Automating Docker and Jenkins Services
&lt;/h2&gt;

&lt;p&gt;Here’s a simple script to automate the starting and stopping of Docker and Jenkins services. This can come in handy for system maintenance or automated deployment pipelines.&lt;br&gt;
&lt;/p&gt;

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

echo "Starting Docker and Jenkins services..."
sudo systemctl start docker
sudo systemctl start jenkins

echo "Stopping Docker and Jenkins services..."
sudo systemctl stop docker
sudo systemctl stop jenkins
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📌 Pro Tip: Save the script as manage_services.sh and make it executable using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x manage_services.sh

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

&lt;/div&gt;



&lt;p&gt;Run it whenever you need to manage these services.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ Additional Tasks for Service Management
&lt;/h2&gt;

&lt;p&gt;Enable Docker on Boot:&lt;br&gt;
Ensure Docker starts on system boot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl enable docker

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

&lt;/div&gt;



&lt;p&gt;Disable Jenkins on Boot:&lt;br&gt;
Prevent Jenkins from starting on boot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl disable jenkins

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

&lt;/div&gt;



&lt;p&gt;Analyzing Logs with journalctl:&lt;br&gt;
To get insights into service logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo journalctl -u docker
sudo journalctl -u jenkins
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  📊 Systemctl vs. Service
&lt;/h2&gt;

&lt;p&gt;You might come across two different commands—  systemctl and service —when managing services in Linux. Let’s quickly break down their differences in a human-friendly way:&lt;/p&gt;

&lt;p&gt;Systemctl is part of Systemd, the newer and more powerful system manager used by most modern Linux distributions. It provides more granular control over services, allowing you to manage units (like services) in a much more flexible way.&lt;/p&gt;

&lt;p&gt;Example: sudo systemctl status docker 🐋&lt;/p&gt;

&lt;p&gt;Service, on the other hand, is the older tool used in SysVinit (the init system before Systemd). It’s still available on most systems for backward compatibility, so if you're running an older Linux version or need a quick, simple command, you might use service.&lt;/p&gt;

&lt;p&gt;Example: sudo service docker status 🖥️&lt;/p&gt;

&lt;p&gt;Key Differences:&lt;/p&gt;

&lt;p&gt;Systemctl offers more advanced and detailed features.&lt;/p&gt;

&lt;p&gt;Service is simpler but more limited in functionality.&lt;/p&gt;

&lt;p&gt;💡 Tip: Always use systemctl for more modern systems and better control!&lt;/p&gt;

&lt;p&gt;🎯 Wrapping Up&lt;/p&gt;

&lt;p&gt;Mastering package managers and service control tools like systemctl is crucial for DevOps professionals. Whether you’re installing new applications or ensuring services run smoothly, the right knowledge makes system administration much more efficient.&lt;/p&gt;

&lt;p&gt;By automating tasks, controlling services, and analyzing logs, you can ensure that your environments remain healthy and responsive.&lt;/p&gt;

&lt;p&gt;Happy coding, and keep automating! ✨&lt;/p&gt;

</description>
    </item>
    <item>
      <title>File Permissions and Access Control Lists</title>
      <dc:creator>FARUKH KHAN</dc:creator>
      <pubDate>Fri, 18 Oct 2024 07:34:23 +0000</pubDate>
      <link>https://dev.to/farukh166/file-permissions-and-access-control-lists-3bf7</link>
      <guid>https://dev.to/farukh166/file-permissions-and-access-control-lists-3bf7</guid>
      <description>&lt;p&gt;File permissions in Linux are crucial for system security, determining who can access, modify, or execute files. As DevOps engineers, understanding how to manage permissions effectively is essential to prevent unauthorized access and ensure smooth workflows. This post covers everything from basic file permissions to ACL (Access Control Lists), SUID, SGID, and Sticky Bit, and even scripts to automate these tasks. Let’s dive in! 🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  📝 Understanding File Permissions
&lt;/h2&gt;

&lt;p&gt;In Linux, every file and directory is associated with three types of permissions: read (r), write (w), and execute (x). These permissions are granted to three categories of users:&lt;/p&gt;

&lt;p&gt;Owner: The user who owns the file.&lt;/p&gt;

&lt;p&gt;Group: The group that owns the file.&lt;/p&gt;

&lt;p&gt;Others: Any other user on the system.&lt;/p&gt;

&lt;p&gt;🔍 Example: Listing File Permissions&lt;/p&gt;

&lt;p&gt;Let’s create a file and check its permissions:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The output will look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-rw-r--r-- 1 user group 0 Oct 18 10:30 myfile.txt

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

&lt;/div&gt;



&lt;p&gt;Here’s what this means:&lt;/p&gt;

&lt;p&gt;-rw-r--r-- → File permissions (r = read, w = write, x = execute)&lt;/p&gt;

&lt;p&gt;Owner (rw-): Read and write permission.&lt;/p&gt;

&lt;p&gt;Group (r--): Only read permission.&lt;/p&gt;

&lt;p&gt;Others (r--): Only read permission.&lt;/p&gt;

&lt;p&gt;1 → Number of links to the file.&lt;/p&gt;

&lt;p&gt;user → The file owner.&lt;/p&gt;

&lt;p&gt;group → The group that owns the file.&lt;/p&gt;

&lt;p&gt;0 → File size (in bytes).&lt;/p&gt;

&lt;p&gt;Oct 18 10:30 → Date and time of last modification.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔧 Modifying Permissions
&lt;/h2&gt;

&lt;p&gt;We can modify file permissions using the following commands:&lt;/p&gt;

&lt;p&gt;Change the owner of the file using chown:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chown newuser myfile.txt

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

&lt;/div&gt;



&lt;p&gt;Change the group of the file using chgrp:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chgrp newgroup myfile.txt

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

&lt;/div&gt;



&lt;p&gt;Modify permissions for others using chmod:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod u-w myfile.txt

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

&lt;/div&gt;



&lt;p&gt;Run ls -ltr again to verify the changes.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🔑 Pro Tip: Always review your file permissions after making changes to avoid accidental exposure of sensitive data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  ✍️ File Permissions
&lt;/h2&gt;

&lt;p&gt;File permissions in Linux are the foundation of security and proper system administration. Every file and directory has associated permissions that dictate how users and groups can interact with them. Understanding these permissions helps to control access levels and ensure the right people have the proper permissions.&lt;/p&gt;

&lt;p&gt;Understanding the Basics&lt;/p&gt;

&lt;p&gt;Each file and directory in Linux is controlled by three permission types:&lt;/p&gt;

&lt;p&gt;Read (r): Grants the ability to view the contents of a file or list the contents of a directory.&lt;/p&gt;

&lt;p&gt;Write (w): Allows the user to modify or delete the contents of a file or add/remove files from a directory.&lt;/p&gt;

&lt;p&gt;Execute (x): Grants permission to run a file (if it's an executable script or binary) or enter a directory.&lt;/p&gt;

&lt;p&gt;These permissions are split across three categories of users:&lt;/p&gt;

&lt;p&gt;Owner (u): The person who created the file and has the most control.&lt;/p&gt;

&lt;p&gt;Group (g): A set of users who share access to the file based on their group membership.&lt;/p&gt;

&lt;p&gt;Others (o): All other users who are not the owner or part of the group.&lt;/p&gt;

&lt;p&gt;Modifying File Permissions: The chmod Command&lt;/p&gt;

&lt;p&gt;You can use the chmod command to modify the permissions of a file. This command can be used in symbolic or numeric modes. Let’s explore both:&lt;/p&gt;

&lt;p&gt;Symbolic Mode:&lt;/p&gt;

&lt;p&gt;In symbolic mode, you can change permissions by specifying which user category (u, g, o) gets which permissions (r, w, x):&lt;/p&gt;

&lt;p&gt;Grant write permission to the group:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod g+w myfile.txt

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

&lt;/div&gt;



&lt;p&gt;Remove execute permission for others:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod o-x myfile.txt

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

&lt;/div&gt;



&lt;p&gt;Numeric Mode:&lt;/p&gt;

&lt;p&gt;In numeric mode, permissions are represented by numbers:&lt;/p&gt;

&lt;p&gt;Read = 4&lt;/p&gt;

&lt;p&gt;Write = 2&lt;/p&gt;

&lt;p&gt;Execute = 1&lt;/p&gt;

&lt;p&gt;So, when you sum them up:&lt;/p&gt;

&lt;p&gt;7 (rwx) = Full permission.&lt;/p&gt;

&lt;p&gt;6 (rw-) = Read and write.&lt;/p&gt;

&lt;p&gt;5 (r-x) = Read and execute.&lt;/p&gt;

&lt;p&gt;4 (r--) = Read only.&lt;/p&gt;

&lt;p&gt;You can set the permissions using a three-digit number where each digit corresponds to the permissions for the owner, group, and others.&lt;/p&gt;

&lt;p&gt;For example, to grant full access to the owner, read and execute permissions to the group, and only read permissions to others:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 754 myfile.txt

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

&lt;/div&gt;



&lt;p&gt;The Role of chown and chgrp&lt;/p&gt;

&lt;p&gt;chown: This command changes the owner of a file:&lt;/p&gt;

&lt;p&gt;sudo chown newowner myfile.txt&lt;/p&gt;

&lt;p&gt;chgrp: This command changes the group ownership of a file:&lt;/p&gt;

&lt;p&gt;sudo chgrp newgroup myfile.txt&lt;/p&gt;

&lt;p&gt;The Importance of File Permissions&lt;/p&gt;

&lt;p&gt;Properly managing file permissions is crucial to maintaining system security and operational efficiency. Whether you are managing a single system or a large infrastructure, the concepts of ownership, groups, and others remain fundamental to controlling file access. Using chmod, chown, and chgrp commands, you can fine-tune who can view, modify, or execute files, ensuring the integrity and confidentiality of your system.&lt;/p&gt;

&lt;h2&gt;
  
  
  🔐 Access Control Lists (ACL)
&lt;/h2&gt;

&lt;p&gt;Access Control Lists (ACLs) provide more granular control over file permissions, allowing you to specify permissions for individual users and groups in addition to the traditional owner-group-others model.&lt;/p&gt;

&lt;p&gt;ACL Commands&lt;/p&gt;

&lt;p&gt;View ACLs with getfacl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;getfacl myfile.txt

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

&lt;/div&gt;



&lt;p&gt;Set ACLs with setfacl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setfacl -m u:username:rwx myfile.txt

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  🎯 Setting ACLs on a Directory
&lt;/h2&gt;

&lt;p&gt;Let’s create a directory and assign specific ACL permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir mydirectory
setfacl -m g:developers:rwx mydirectory
getfacl mydirectory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, the developers group is granted full access to the mydirectory. ACLs provide flexibility in managing permissions across multiple users and teams, which is especially useful in collaborative environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ Additional Automation Tasks
&lt;/h2&gt;

&lt;h2&gt;
  
  
  🔄 Task: Script to Modify File Permissions
&lt;/h2&gt;

&lt;p&gt;When dealing with multiple files, automating permission changes can save significant time. Here’s a script that modifies permissions for all files in a directory based on user input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
echo "Enter directory path:"
read dir
echo "Enter permissions (e.g., 755):"
read perm
chmod -R $perm $dir
echo "Permissions updated for all files in $dir"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To Run the Script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x change_permissions.sh
./change_permissions.sh

Enter directory path:
myfile
Enter permissions (e.g., 755):
000
Permissions updated for all files in myfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔒 Task: Script to Set ACL for a Specific User
&lt;/h2&gt;

&lt;p&gt;This script allows you to set ACL permissions for a user on a specific file based on user input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
echo "Enter file path:"
read file
echo "Enter username:"
read user
echo "Enter permissions (e.g., rwx):"
read perm
setfacl -m u:$user:$perm $file
echo "ACL set for $user on $file"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To Run the Script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x set_acl.sh
./set_acl.sh

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  🚦 Understanding Sticky Bit, SUID, and SGID
&lt;/h2&gt;

&lt;p&gt;🧷 Sticky Bit: Restricts file deletion in a directory to the owner. It's often used in shared directories like /tmp.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +t /tmp

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

&lt;/div&gt;



&lt;p&gt;🔐 SUID (Set User ID): Allows a file to be executed with the permissions of the file owner rather than the user running the file.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod u+s myscript.sh

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

&lt;/div&gt;



&lt;p&gt;👥 SGID (Set Group ID): Files created in a directory inherit the group of the directory, ensuring that group ownership is maintained.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod g+s /sharedfolder

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  📂 Backup and Restore Permissions
&lt;/h2&gt;

&lt;p&gt;Sometimes, you may need to back up file permissions before making changes. The following scripts will back up and restore permissions using ACL:&lt;/p&gt;

&lt;h2&gt;
  
  
  🗄️ Backup Script:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
echo "Enter directory to backup permissions:"
read dir
getfacl -R $dir &amp;gt; permissions_backup.acl
echo "Permissions backed up to permissions_backup.acl"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To Run the Script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x backup_permissions.sh
./backup_permissions.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔄 Restore Script:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
echo "Enter directory to restore permissions:"
read dir
setfacl --restore=permissions_backup.acl
echo "Permissions restored from permissions_backup.acl"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To Run the Script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x restore_permissions.sh
./restore_permissions.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🚀Wrapping It Up 🎁&lt;br&gt;
And there you have it, folks! You're now armed with the knowledge to bend file permissions to your will. Remember, with great power comes great responsibility (and fewer "Permission denied" errors).&lt;br&gt;
Keep experimenting, stay curious, and may your systems always be secure! 🔐💪&lt;/p&gt;

&lt;h1&gt;
  
  
  DevOps #Linux #FilePermissionNinja #SecuritySuperhero #BashScriptingWizard
&lt;/h1&gt;

&lt;p&gt;P.S. Did this guide help you level up your DevOps game? Share it with your fellow tech adventurers and spread the file permission love! 💖&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>bash</category>
    </item>
    <item>
      <title>Advanced Linux Shell Scripting for DevOps Engineers with User Management</title>
      <dc:creator>FARUKH KHAN</dc:creator>
      <pubDate>Thu, 17 Oct 2024 18:40:46 +0000</pubDate>
      <link>https://dev.to/farukh166/advanced-linux-shell-scripting-for-devops-engineers-with-user-management-2dna</link>
      <guid>https://dev.to/farukh166/advanced-linux-shell-scripting-for-devops-engineers-with-user-management-2dna</guid>
      <description>&lt;p&gt;As DevOps engineers, automation is our best friend. Shell scripting, backups, cron jobs, and user management are essential skills that help us streamline day-to-day operations. In this blog, I’ll walk you through practical tasks that will enhance your DevOps expertise while touching on key concepts that simplify complex workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  📁 Task 1: Dynamic Directory Creation with Shell Scripts
&lt;/h2&gt;

&lt;p&gt;Automating routine tasks, like creating directories, is a great way to simplify your work. Let’s create a bash script, createDirectories.sh, to dynamically generate a set of directories based on a given range of numbers.&lt;/p&gt;

&lt;p&gt;Shell Script to Create Directories:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
# Ensure exactly 3 arguments are passed
if [ $# -ne 3 ]; then
    echo "Usage: $0 &amp;lt;directory_name&amp;gt; &amp;lt;start_number&amp;gt; &amp;lt;end_number&amp;gt;"
    exit 1
fi

# Assign input arguments to variables
dir_name=$1
start=$2
end=$3

# Loop to create directories
for (( i=$start; i&amp;lt;=$end; i++ ))
do
    mkdir "${dir_name}${i}"
    echo "Directory ${dir_name}${i} created"
done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How It Works:&lt;/p&gt;

&lt;p&gt;This script accepts three arguments: a base directory name, a starting number, and an ending number.&lt;/p&gt;

&lt;p&gt;It uses a for loop to iterate through the given range and create directories with dynamic names.&lt;/p&gt;

&lt;p&gt;Make the script executable by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; chmod +x createDirectories.sh

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

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./createDirectories.sh day 1 90

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

&lt;/div&gt;



&lt;p&gt;This command will create directories named day1, day2, day3... up to day90. Similarly, you can create directories with other names:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./createDirectories.sh Movie 20 50

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

&lt;/div&gt;



&lt;p&gt;This creates directories from Movie20 to Movie50. A simple yet powerful script that saves you from repetitive manual tasks! ⚙️&lt;/p&gt;

&lt;h2&gt;
  
  
  🔄Task 2: Automating Backups with a Shell Script
&lt;/h2&gt;

&lt;p&gt;Backups are a critical part of maintaining system integrity in DevOps. Creating an automated backup script ensures that your data is regularly saved without manual intervention.&lt;/p&gt;

&lt;p&gt;Backup Script:&lt;br&gt;
&lt;/p&gt;

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

# Define source and destination directories
src="/path/to/source/"
dest="/path/to/backup/folder/$(date +%Y-%m-%d_%H-%M-%S)"

# Create a backup folder with a timestamp
mkdir -p "$dest"

# Copy all files to the backup directory
cp -r "$src" "$dest"
echo "Backup completed successfully!"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script takes the contents from a source folder and backs them up into a destination folder with the current timestamp. This way, each backup has a unique identifier, ensuring easy tracking of previous backups. 🗂️&lt;/p&gt;

&lt;p&gt;Make the script executable by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; chmod +x backupScript.sh

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  ⏰Task 3: Scheduling Backups with Cron
&lt;/h2&gt;

&lt;p&gt;Now that we’ve got our backup script ready, we can schedule it using cron, a time-based job scheduler in Unix-like operating systems. With cron, you can automate your backups, ensuring they happen at regular intervals without any manual intervention.&lt;/p&gt;

&lt;p&gt;Setting Up Cron for Daily Backups:&lt;/p&gt;

&lt;p&gt;Open the crontab file to edit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;crontab -e

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

&lt;/div&gt;



&lt;p&gt;Add the following line to schedule the backup script to run every day at 2 AM:&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;This ensures your backup script runs automatically at 2 AM each day, reducing the risk of data loss due to human error. 🕒&lt;/p&gt;

&lt;p&gt;Here's a quick Cron syntax refresher:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* * * * * command_to_execute
│ │ │ │ │
│ │ │ │ └─── Day of the week (0 - 7) (Sunday = 0 or 7)
│ │ │ └──────── Month (1 - 12)
│ │ └───────────── Day of the month (1 - 31)
│ └────────────────── Hour (0 - 23)
└─────────────────────── Minute (0 - 59)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  👥Task 4: Managing Users in Linux
&lt;/h2&gt;

&lt;p&gt;User management is another essential skill in DevOps. A proper understanding of how to add, manage, and remove users ensures that you can control access to your systems effectively.&lt;/p&gt;

&lt;p&gt;Adding Users:&lt;/p&gt;

&lt;p&gt;Use the following commands to create two users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo useradd -m devops_ninja
sudo useradd -m code_warrior
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To verify the users, you can list all the system users with this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cat /etc/passwd | grep 'devops_ninja\|code_warrior'

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

&lt;/div&gt;



&lt;p&gt;Why User Management Matters:&lt;/p&gt;

&lt;p&gt;Managing users in a system is crucial for security, resource allocation, and access control. Whether you’re administering a small team or managing users across multiple systems, these commands ensure you’re in control.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎉 Wrapping Up
&lt;/h2&gt;

&lt;p&gt;Phew! We've covered a lot of ground today, from bash scripting to user management. Remember, practice makes perfect in the world of DevOps. Keep tinkering, keep learning, and most importantly, keep automating!&lt;/p&gt;

&lt;p&gt;Don't forget to share your progress on LinkedIn and join the conversation in the #90DaysOfDevOps Challenge. Let's grow together as a community! 💪&lt;/p&gt;

&lt;p&gt;Happy DevOps-ing, and until next time, may your pipelines be green and your deployments smooth! 🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Basic Linux Shell Scripting for DevOps Engineers</title>
      <dc:creator>FARUKH KHAN</dc:creator>
      <pubDate>Wed, 16 Oct 2024 18:23:44 +0000</pubDate>
      <link>https://dev.to/farukh166/basic-linux-shell-scripting-for-devops-engineers-4fjf</link>
      <guid>https://dev.to/farukh166/basic-linux-shell-scripting-for-devops-engineers-4fjf</guid>
      <description>&lt;p&gt;As a DevOps engineer, shell scripting is an essential skill that can significantly enhance your efficiency and automation capabilities. In this blog post, we'll explore the importance of shell scripting in DevOps and provide practical examples to illustrate key concepts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Shell Scripting: The DevOps Secret Weapon 🛠️
&lt;/h2&gt;

&lt;p&gt;Imagine you are a DevOps engineer, balancing a million tasks and wishing you had an extra pair of hands. Enter shell scripting—your virtual assistant in the command-line world! 🧙‍♂️&lt;/p&gt;

&lt;p&gt;Shell scripting in DevOps is like having a magic wand that can:&lt;/p&gt;

&lt;p&gt;Automate repetitive tasks (because who likes doing the same thing over and over?) 🔁&lt;/p&gt;

&lt;p&gt;Manage system configurations (keeping your servers in tip-top shape) 🖥️&lt;/p&gt;

&lt;p&gt;Deploy applications (push that code to production with style!) 🚢&lt;/p&gt;

&lt;p&gt;Perform system maintenance (like a health check-up for your infrastructure). 🩺&lt;/p&gt;

&lt;p&gt;Create custom tools (tailor-made solutions for your unique needs). 🛠️&lt;/p&gt;

&lt;p&gt;Imagine automating your database backups, updating software across a fleet of servers, or setting up new development environments in minutes. That's the power of shell scripting in action!&lt;/p&gt;

&lt;h2&gt;
  
  
  🖥️ Understanding #!/bin/bash: What Does It Do?
&lt;/h2&gt;

&lt;p&gt;The very first line of most shell scripts begins with #!/bin/bash. This is called the shebang (or hashbang), and it tells the system which interpreter to use when running the script. 💡&lt;/p&gt;

&lt;p&gt;"#!/bin/bash: This tells the system to use the Bash shell (one of the most commonly used shells)."&lt;br&gt;
"#!/bin/sh: This uses the sh shell, which is more basic and often more portable across Unix-like systems."&lt;br&gt;
While both bash and sh are similar, Bash provides more advanced features and is often preferred in modern systems. For example, Bash supports arrays, more advanced string manipulation, and better control structures than sh.&lt;/p&gt;

&lt;p&gt;✍️ Writing Your First Shell Script&lt;br&gt;
Let’s get hands-on with a simple shell script that prints a message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
# A simple shell script to print a message

echo "I will complete the #90DaysOfDevOps challenge."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📝 Breaking it down:&lt;/p&gt;

&lt;p&gt;The #!/bin/bash line tells the system to use Bash to run the script.&lt;br&gt;
echo is the command that prints the message to the screen.&lt;br&gt;
To run this script:&lt;/p&gt;

&lt;p&gt;Save the file as devops_challenge.sh.&lt;br&gt;
Make the script executable by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x devops_challenge.sh

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

&lt;/div&gt;



&lt;p&gt;Execute the script:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The output will be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I will complete the #90DaysOfDevOps challenge.

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

&lt;/div&gt;



&lt;p&gt;🧑‍💻 Capturing User Input and Command-Line Arguments&lt;br&gt;
Let’s create a script that takes input directly from the user, as well as from command-line arguments, and prints the results.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
# A script that captures user input and arguments

# Prompt the user for input
echo "Please enter your name:"
read name

# Capture command-line arguments
arg1=$1
arg2=$2

# Print the user input and arguments
echo "Hello, $name! You provided '$arg1' and '$arg2' as arguments."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;read is used to capture input directly from the user.&lt;br&gt;
$1, $2, etc., are used to capture command-line arguments passed when the script is executed.&lt;/p&gt;

&lt;p&gt;🛠️ Running the script:&lt;br&gt;
Save the script as input_script.sh.&lt;br&gt;
Make it executable and run it with arguments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x input_script.sh
./input_script.sh devops automation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When prompted, enter your name. You’ll see output like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Please enter your name:
Farukh
Hello, Farukh! You provided 'devops' and 'automation' as arguments.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔄 Using If-Else in Shell Scripting: A Simple Comparison&lt;br&gt;
Conditional statements are a crucial part of any programming language, and shell scripting is no different. Here’s a simple example using an if-else statement to compare two numbers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
# A script to compare two numbers

num1=10
num2=20

if [ $num1 -gt $num2 ]; then
    echo "$num1 is greater than $num2"
else
    echo "$num1 is less than or equal to $num2"
fi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🧩 Explanation:&lt;br&gt;
The if [ condition ]; then ... fi structure checks the condition and executes the corresponding block of code.&lt;br&gt;
-gt stands for "greater than." Other comparison operators include -lt (less than), -eq (equal to), etc.&lt;/p&gt;

&lt;p&gt;⚙️ How to run it:&lt;br&gt;
Save the script as compare_numbers.sh.&lt;br&gt;
Make it executable:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x compare_numbers.sh

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

&lt;/div&gt;



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

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

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

&lt;/div&gt;



&lt;p&gt;The output will be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10 is less than or equal to 20

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

&lt;/div&gt;



&lt;p&gt;Wrapping Up: Your DevOps Journey Awaits! 🌟&lt;br&gt;
And there you have it, folks! You've just dipped your toes into the vast ocean of shell scripting for DevOps. With these basics under your belt, you're well on your way to creating scripts that'll make your colleagues go "Wow!" 😮&lt;br&gt;
Remember, the key to mastering shell scripting is practice, curiosity, and a dash of creativity. So, keep exploring, keep coding, and most importantly, have fun with it!&lt;br&gt;
Ready to level up your DevOps game? Embrace the power of shell scripting and watch your productivity soar! 🚀&lt;br&gt;
Happy scripting, and may the DevOps force be with you! 💻✨&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Linux Commands for DevOps Engineers: A Practical Guide</title>
      <dc:creator>FARUKH KHAN</dc:creator>
      <pubDate>Mon, 07 Oct 2024 16:38:31 +0000</pubDate>
      <link>https://dev.to/farukh166/linux-commands-for-devops-engineers-a-practical-guide-575o</link>
      <guid>https://dev.to/farukh166/linux-commands-for-devops-engineers-a-practical-guide-575o</guid>
      <description>&lt;p&gt;As a DevOps engineer, mastering Linux commands is crucial for efficient system management and automation. In this blog post, we'll explore some essential Linux commands that every DevOps professional should know. Let's dive in!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;View the content of a file and display line numbers
To view a file's content with line numbers, use the cat or nl command. Here's an example:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;The -n option in cat displays line numbers, while nl directly shows the content with line numbers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change the access permissions of files to make them readable, writable, and executable by the owner only
To modify file permissions so that only the owner has read, write, and execute rights, use the chmod command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 700 filename.txt

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

&lt;/div&gt;



&lt;p&gt;In this case, 7 gives the owner all permissions (read, write, and execute), while 0 denies all permissions for the group and others.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check the last 10 commands you have run
To view the last 10 commands you executed, use the history command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;history | tail -10

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

&lt;/div&gt;



&lt;p&gt;This displays the last 10 entries from your command history.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove a directory and all its contents
To remove a directory and all of its contents, including subdirectories and files, use the rm command with the -r and -f flags:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;p&gt;-r: Recursively removes directories and their contents.&lt;br&gt;
-f: Forces removal without prompting for confirmation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a fruits.txt file, add content (one fruit per line), and display the content
You can create the fruits.txt file and add content with the echo command or a text editor like nano:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" &amp;gt; fruits.txt
cat fruits.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command creates a file called fruits.txt with each fruit on a new line, and cat displays the file content.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add content in devops.txt (one in each line), and then append "Pineapple" to the end of the file
To add fruits to devops.txt and then append "Pineapple" at the end:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo -e "Apple\nMango\nBanana\nCherry\nKiwi\nOrange\nGuava" &amp;gt; devops.txt
echo "Pineapple" &amp;gt;&amp;gt; devops.txt
cat devops.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &amp;gt;&amp;gt; operator appends data to the file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Show the first three fruits from the file in reverse order
To display the first three fruits in reverse order, use a combination of head and tac:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;head -3 fruits.txt | tac
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;head -3 extracts the first three lines.&lt;br&gt;
tac reverses the order of the lines.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Show the bottom three fruits from the file, and then sort them alphabetically
To display the bottom three fruits and sort them alphabetically, use tail and sort:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tail -3 fruits.txt | sort
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;tail -3 extracts the last three lines.&lt;br&gt;
sort organizes them alphabetically.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create another file Colors.txt, add content (one color per line), and display the content
To create Colors.txt and add content:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo -e "Red\nPink\nWhite\nBlack\nBlue\nOrange\nPurple\nGrey" &amp;gt; Colors.txt
cat Colors.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This adds each color to a new line in the Colors.txt file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add content in Colors.txt, then prepend "Yellow" to the beginning of the file
To prepend "Yellow" at the beginning of Colors.txt:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo -e "Yellow\n$(cat Colors.txt)" &amp;gt; Colors.txt
cat Colors.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command adds "Yellow" at the start by reading the original file content and prepending it with "Yellow."&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find and display the lines that are common between fruits.txt and Colors.txt
To find the common lines between the two files:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;comm -12 &amp;lt;(sort fruits.txt) &amp;lt;(sort Colors.txt)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The comm command compares the two sorted files and shows the common lines.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Count the number of lines, words, and characters in both fruits.txt and Colors.txt
To count the number of lines, words, and characters, use the wc (word count) command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wc fruits.txt Colors.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output displays the counts for each file in the format:&lt;br&gt;
lines words characters filename.&lt;/p&gt;

&lt;p&gt;By mastering these Linux commands, DevOps engineers can streamline their workflow and enhance their productivity. Remember to practice these commands in a safe environment before applying them to production systems. Happy coding!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Linux Fundamentals</title>
      <dc:creator>FARUKH KHAN</dc:creator>
      <pubDate>Sun, 06 Oct 2024 18:44:16 +0000</pubDate>
      <link>https://dev.to/farukh166/linux-fundamentals-64h</link>
      <guid>https://dev.to/farukh166/linux-fundamentals-64h</guid>
      <description>&lt;p&gt;A DevOps Engineer’s Guide to Linux: Mastering the Essential Commands&lt;br&gt;
In the world of DevOps, Linux stands as the backbone of most IT infrastructures. Understanding and mastering Linux commands is crucial for system management, automation, and seamless deployment in a professional environment. This guide provides an in-depth look at the most essential Linux commands every DevOps engineer should know.&lt;/p&gt;

&lt;p&gt;Why Linux Matters in DevOps&lt;br&gt;
Linux, a powerful open-source operating system, is known for its stability, flexibility, and widespread use in server environments. As a DevOps engineer, working with Linux is unavoidable, as it powers most cloud platforms, containers, and server environments. Mastering the basics ensures that you can efficiently manage systems, troubleshoot issues, and automate repetitive tasks.&lt;/p&gt;

&lt;p&gt;A Brief History of Linux&lt;br&gt;
Linux was born from a desire for freedom. In 1991, Linus Torvalds, a Finnish computer science student, released the first version of what would become the Linux kernel, an open-source alternative to proprietary Unix systems. Torvalds wanted a free operating system kernel that mimicked the features of Unix but was free to use and modify by anyone.&lt;/p&gt;

&lt;p&gt;Basic Linux Commands Every DevOps Engineer Should Know&lt;br&gt;
🔧 1. Navigating the File System&lt;/p&gt;

&lt;p&gt;Working with files and directories is a fundamental task in Linux. The following commands help you navigate, create, and manage the file system.&lt;/p&gt;

&lt;p&gt;ls: Displays a list of files and directories in the current location.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ls          # Lists files and directories
  ls -l       # Lists in long format (detailed view)
  ls -a       # Includes hidden files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;cd: Changes the current working directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  cd /path/to/directory   # Navigates to a specific directory
  cd ..                   # Moves up one directory level
  cd ~                    # Returns to the home directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;pwd: Prints the current working directory (useful to check where you are).&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;mkdir: Creates a new directory.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;rmdir: Removes an empty directory.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;📁 2. Managing Files and Directories&lt;/p&gt;

&lt;p&gt;After navigating the file system, you will frequently need to copy, move, and remove files or directories. The following commands help with file and directory management:&lt;/p&gt;

&lt;p&gt;cp: Copies files or directories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  cp file.txt /destination/path/     # Copies a file
  cp -r dir1/ /destination/path/     # Recursively copies a directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;mv: Moves or renames files and directories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  mv file.txt /new/path/             # Moves a file
  mv oldname.txt newname.txt         # Renames a file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;rm: Removes files or directories.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  rm file.txt                # Deletes a file
  rm -r directory_name       # Deletes a directory and its contents
  rm -f file.txt             # Forces deletion without confirmation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;touch: Creates an empty file or updates the timestamp of an existing file.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;🛠 3. Viewing and Editing Files&lt;/p&gt;

&lt;p&gt;Managing and reviewing file content is another critical task. Here are commands to display and modify file content:&lt;/p&gt;

&lt;p&gt;cat: Displays the entire content of a file.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;less: Views file content one page at a time (useful for large files).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  less file.txt

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

&lt;/div&gt;



&lt;p&gt;head: Displays the first few lines of a file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  head -n 10 file.txt       # Displays the first 10 lines

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

&lt;/div&gt;



&lt;p&gt;tail: Displays the last few lines of a file (useful for checking log files).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  tail -n 20 file.txt       # Displays the last 20 lines
  tail -f logfile.log       # Follows the file as it gets updated in 
                              real-time
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔒 4. Managing Permissions and Ownership&lt;/p&gt;

&lt;p&gt;File permissions in Linux are essential for maintaining security. The system uses a permission model that defines what actions users can perform on files and directories.&lt;/p&gt;

&lt;p&gt;chmod: Changes the file permissions (read, write, execute) for user, group, and others.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  chmod 755 script.sh    # Grants read, write, and execute to owner, and read/execute to others
  chmod 644 file.txt     # Read/write for owner, read-only for group and others
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;chown: Changes the ownership of a file or directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  chown user:group file.txt    # Changes ownership of the file to the specified user and group
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📊 5. System Monitoring and Resource Usage&lt;/p&gt;

&lt;p&gt;Monitoring system performance is a critical part of DevOps. Here are commands that help you keep track of system resources:&lt;/p&gt;

&lt;p&gt;top: Provides a dynamic, real-time view of running processes and resource usage (CPU, memory, etc.).&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;htop: A more user-friendly version of top that offers an interactive interface for viewing processes.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;df: Shows disk space usage of file systems.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  df -h        # Shows disk space in human-readable format

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

&lt;/div&gt;



&lt;p&gt;du: Displays the size of directories and their contents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  du -sh /path/to/directory/     # Summarizes total size in human-readable format
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;free: Displays memory (RAM) usage.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;🌐 6. Networking Commands&lt;/p&gt;

&lt;p&gt;Linux provides powerful tools to monitor and manage networking. These commands are essential for troubleshooting connectivity issues and managing network configurations.&lt;/p&gt;

&lt;p&gt;ping: Tests network connectivity to a host.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ping google.com          # Sends ICMP packets to check connectivity

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

&lt;/div&gt;



&lt;p&gt;ifconfig: Displays or configures network interfaces.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ifconfig                 # Shows current network configurations

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

&lt;/div&gt;



&lt;p&gt;netstat: Displays network connections, routing tables, and interface statistics.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  netstat -tuln            # Shows listening ports and services

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

&lt;/div&gt;



&lt;p&gt;curl: Transfers data from or to a server, useful for testing APIs and endpoints.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  curl http://example.com   # Sends a request to the URL and displays the response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💾 7. Package Management&lt;/p&gt;

&lt;p&gt;Managing software packages is a crucial aspect of system administration. The package management tool depends on the Linux distribution:&lt;/p&gt;

&lt;p&gt;apt (Debian/Ubuntu): Installs, updates, and removes software packages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  sudo apt update           # Updates package list
  sudo apt install nginx    # Installs nginx
  sudo apt remove nginx     # Removes nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;yum (CentOS/RedHat): Installs, updates, and removes software packages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  sudo yum update           # Updates package list
  sudo yum install nginx    # Installs nginx
  sudo yum remove nginx     # Removes nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚙️ 8. User Management&lt;/p&gt;

&lt;p&gt;Managing users and permissions is key to maintaining a secure Linux environment. These commands help manage user accounts and permissions:&lt;/p&gt;

&lt;p&gt;useradd: Adds a new user to the system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  sudo useradd newuser

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

&lt;/div&gt;



&lt;p&gt;passwd: Changes a user’s password.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  sudo passwd newuser

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

&lt;/div&gt;



&lt;p&gt;usermod: Modifies user properties, such as adding a user to a group.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  sudo usermod -aG sudo newuser    # Adds user to the sudo group

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

&lt;/div&gt;



&lt;p&gt;whoami: Displays the current logged-in user.&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;Conclusion&lt;/p&gt;

&lt;p&gt;Understanding the what, why, and how of basic Linux commands is essential for any DevOps engineer. These commands form the foundation of daily system administration, automation, and troubleshooting tasks. As you build on this knowledge, you’ll be better equipped to streamline your workflows and manage complex infrastructures efficiently. So, dive in and start mastering Linux today! 🚀&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introduction to Devops</title>
      <dc:creator>FARUKH KHAN</dc:creator>
      <pubDate>Sat, 05 Oct 2024 15:01:30 +0000</pubDate>
      <link>https://dev.to/farukh166/introduction-to-devops-1210</link>
      <guid>https://dev.to/farukh166/introduction-to-devops-1210</guid>
      <description>&lt;p&gt;🚀 Demystifying DevOps: The Engine of Modern Software Development 🛠️&lt;br&gt;
Hey connections! 👋 As we dive deeper into the world of tech, I wanted to share some insights on a game-changing approach that's revolutionizing how we build and deliver software. Let's talk DevOps! 🔄&lt;/p&gt;

&lt;p&gt;What is DevOps? 🤔&lt;br&gt;
DevOps isn't just a buzzword – it's a culture, a set of practices, and a philosophy that bridges the gap between development (Dev) and operations (Ops) teams. It's about fostering collaboration, automation, and continuous improvement throughout the software development lifecycle.&lt;/p&gt;

&lt;p&gt;The Pillars of DevOps Success 🏛️&lt;br&gt;
⚙️ Automation, Scaling, and Infrastructure&lt;br&gt;
Automation: Imagine pushing a button and having everything—from code deployment to testing—happen automatically. That’s the magic of automation! It removes manual intervention, reduces human errors, and accelerates processes. Whether it's CI/CD pipelines or infrastructure provisioning, automation is the backbone of DevOps. 🖥️✨&lt;/p&gt;

&lt;p&gt;Scaling: Ever wonder how applications like Netflix handle millions of users simultaneously? That's scaling in action! Through scalable infrastructure, DevOps ensures that your system can grow with demand, without breaking a sweat. Cloud platforms like AWS and Azure enable dynamic scaling to match real-time needs, whether it’s a small startup or a large enterprise. ☁️🔝&lt;/p&gt;

&lt;p&gt;Infrastructure as Code (IaC): With tools like Terraform and Ansible, managing infrastructure is now as easy as writing code. IaC allows teams to version control their infrastructure, making deployments more predictable and consistent. Plus, it's easier to replicate environments across development, staging, and production, ensuring smooth deployments every time. 📜🔧&lt;/p&gt;

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

&lt;p&gt;🔍 Why is DevOps So Important?&lt;br&gt;
In the digital era, speed and agility are non-negotiable. Here’s why DevOps is a game-changer:&lt;/p&gt;

&lt;p&gt;Faster Time to Market: DevOps enables frequent, smaller releases, so companies can deliver new features and updates faster than ever before. 📅⚡&lt;/p&gt;

&lt;p&gt;Improved Collaboration: With development and operations working together, communication improves, leading to fewer misunderstandings, reduced downtime, and a more cohesive team. 👫🤝&lt;/p&gt;

&lt;p&gt;Enhanced Reliability: Automated testing, monitoring, and alerting systems ensure early detection of issues, resulting in increased system reliability. 🔒&lt;/p&gt;

&lt;p&gt;Customer-Centric Focus: By automating processes, teams can spend more time focusing on customer needs and delivering value, rather than firefighting technical issues. 🧑‍💻❤️&lt;/p&gt;

&lt;p&gt;DevOps isn't just changing how we work—it's transforming businesses and driving digital transformation across industries. As we continue to evolve in this space, the possibilities are endless!&lt;/p&gt;

&lt;p&gt;What's your take on DevOps? Have you implemented these practices in your organization? Let's discuss in the comments below! 👇&lt;/p&gt;

&lt;h1&gt;
  
  
  DevOps #ContinuousImprovement #TechInnovation #90DaysOfDevOps
&lt;/h1&gt;

</description>
    </item>
  </channel>
</rss>
