<?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: DevOps Man</title>
    <description>The latest articles on DEV Community by DevOps Man (@vishnutejas).</description>
    <link>https://dev.to/vishnutejas</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%2F1985331%2Ff22e32ee-f76e-4e8f-9119-5c8593ae9cfe.jpg</url>
      <title>DEV Community: DevOps Man</title>
      <link>https://dev.to/vishnutejas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vishnutejas"/>
    <language>en</language>
    <item>
      <title>Mastering CMake: A Practical Guide for DevOps Engineers and Developers</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Sat, 10 May 2025 03:49:30 +0000</pubDate>
      <link>https://dev.to/vishnutejas/mastering-cmake-a-practical-guide-for-devops-engineers-and-developers-35eg</link>
      <guid>https://dev.to/vishnutejas/mastering-cmake-a-practical-guide-for-devops-engineers-and-developers-35eg</guid>
      <description>&lt;p&gt;CMake is the backbone of modern C++ build systems. Whether you're compiling a simple executable or orchestrating large-scale multi-module projects with external libraries, mastering CMake can make your builds cleaner, faster, and more maintainable.&lt;/p&gt;

&lt;p&gt;This guide captures everything you need to know to write robust CMakeLists.txt files with real-world examples and explanations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Basic CMake Commands&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Project Structure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Commonly Used Variables&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Best Practices&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compiler Warnings&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configuring files&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unit Testing with Catch2&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compile Features and Definitions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sanitizers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;IPO &amp;amp; LTO&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generator Expressions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;External Libraries (Git Submodules &amp;amp; FetchContent)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Useful CMake CLI Flags&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Basic CMake Commands
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;cmake_minimum_required(VERSION 3.10)&lt;/code&gt;&lt;br&gt;
This command specifies the minimum CMake version required for your project. It should be the first line in your top-level CMakeLists.txt.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;project(MyApp VERSION 1.0 LANGUAGES CXX)&lt;/code&gt;&lt;br&gt;
Defines the project name, version, and language.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;add_executable(MyApp main.cpp helper.cpp)&lt;/code&gt;&lt;br&gt;
This tells CMake to compile main.cpp and helper.cpp into an executable named MyApp. You can list as many source files as needed. The target name (MyApp) is used in other commands, like target_link_libraries(MyApp PRIVATE SomeLib)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;add_library(MyLib STATIC mylib.cpp)&lt;/code&gt;&lt;br&gt;
Defines a library named MyLib.&lt;/p&gt;

&lt;p&gt;STATIC: Creates a static library (.lib or .a). Linked at compile time.&lt;br&gt;
SHARED: Creates a shared (dynamic) library (.dll or .so). Loaded at runtime.&lt;br&gt;
MODULE: Creates a library that is not linked but loaded at runtime (e.g., for plugins).&lt;br&gt;
INTERFACE: No output file is built. Used for header-only libraries.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;target_include_directories(MyLib PUBLIC include)&lt;/code&gt;&lt;br&gt;
Specifies include directories. Types:&lt;/p&gt;

&lt;p&gt;PUBLIC: Used by both the library and users&lt;br&gt;
PRIVATE: Used only by the library&lt;br&gt;
INTERFACE: Used only by users&lt;/p&gt;

&lt;p&gt;&lt;code&gt;add_subdirectory(utils)&lt;/code&gt;&lt;br&gt;
Includes utils/CMakeLists.txt in the build.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;target_link_libraries(MyApp PRIVATE MyLib)&lt;/code&gt;&lt;br&gt;
Links MyLib with MyApp.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;set(MY_VAR "value")&lt;/code&gt;&lt;br&gt;
Defines a variable.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;option(BUILD_TESTS "Build test binaries" ON)&lt;/code&gt;&lt;br&gt;
Defines a boolean option with description.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if(USE_MY_FEATURE)
    message(STATUS "Building with my feature")
else()
    message(STATUS "Building without my feature")
endif()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Conditional logic in CMake.&lt;/p&gt;




&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project-root/
├── CMakeLists.txt
├── main.cpp
├── include/
│   └── mylib.hpp
├── src/
│   └── mylib.cpp
├── tests/
│   ├── CMakeLists.txt
│   └── test_main.cpp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Commonly Used Variables
&lt;/h2&gt;

&lt;p&gt;CMAKE_SOURCE_DIR: Top-level source directory&lt;br&gt;
CMAKE_PROJECT_NAME: Name set in project()&lt;br&gt;
CMAKE_BINARY_DIR: Top-level build directory&lt;br&gt;
CMAKE_CURRENT_SOURCE_DIR: Source dir of the current CMakeLists.txt&lt;br&gt;
CMAKE_CURRENT_LIST_DIR: Directory containing the currently processed CMake file&lt;br&gt;
CMAKE_MODULE_PATH: List of additional module directories&lt;/p&gt;


&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;p&gt;✅ Always list files manually instead of using file(GLOB ...)&lt;br&gt;
✅ Modularize using add_subdirectory()&lt;br&gt;
✅ Use target_* commands (not global ones)&lt;br&gt;
✅ Separate headers and sources by folder&lt;br&gt;
❌ Don’t pollute global scope with variables&lt;/p&gt;


&lt;h2&gt;
  
  
  Compiler Warnings
&lt;/h2&gt;

&lt;p&gt;target_compile_options() adds compiler flags/options at compile time to a specific target (executable or library).&lt;br&gt;
Use portable warnings with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;target_compile_options(MyApp PRIVATE
  $&amp;lt;$&amp;lt;CXX_COMPILER_ID:GNU,Clang&amp;gt;:-Wall -Wextra -Wpedantic&amp;gt;
  $&amp;lt;$&amp;lt;CXX_COMPILER_ID:MSVC&amp;gt;:/W4&amp;gt;
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🚀 Common Compiler Flags (for GCC/Clang)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Flag&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Meaning&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-Wall&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enable most common warnings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-Wextra&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enable additional warnings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-Werror&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Treat warnings as errors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;-O2&lt;/code&gt;, &lt;code&gt;-O3&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Optimization levels (O2 = good speed, O3 = aggressive)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-g&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Generate debug symbols for gdb or lldb&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-std=c++17&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Use C++17 standard (replace with &lt;code&gt;c++11&lt;/code&gt;, &lt;code&gt;c++20&lt;/code&gt;, etc.)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-DDEBUG&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Define macro &lt;code&gt;DEBUG&lt;/code&gt;, useful for conditional code blocks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;-fPIC&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Position Independent Code (for shared libraries)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Configuring Files with configure_file
&lt;/h2&gt;

&lt;p&gt;CMake’s configure_file() command lets you copy and process a template file at configure time, replacing variable placeholders. For example, if you have a header template file.h.in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// file.h.in
#define VERSION @PROJECT_VERSION@
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and in your CMakeLists.txt you do:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project(MyApp VERSION 1.2.3)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/file.h.in
               ${CMAKE_CURRENT_BINARY_DIR}/file.h
               @ONLY)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CMake will produce file.h in the build directory with @PROJECT_VERSION@ replaced by the actual version string (e.g. #define VERSION 1.2.3). In general, configure_file() copies a “.in” file to the build tree and substitutes any ${VAR} with the current CMake variable values&lt;br&gt;
cliutils.gitlab.io&lt;br&gt;
. This is very useful for generating headers (or even .cmake files) that convey build-time settings like version, feature toggles, or compile options. Remember to add the build directory to your include path (e.g. via target_include_directories) so that code can #include "file.h" from the generated location.&lt;/p&gt;


&lt;h2&gt;
  
  
  Unit Testing with Catch2
&lt;/h2&gt;

&lt;p&gt;Setup&lt;br&gt;
&lt;code&gt;git submodule add https://github.com/catchorg/Catch2.git external/Catch2&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  CMakeLists.txt
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add_subdirectory(external/Catch2)
add_executable(tests test_main.cpp)
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain)
include(CTest)
include(Catch)
catch_discover_tests(tests)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Compile Features and Definitions
&lt;/h2&gt;

&lt;p&gt;Enforce Features&lt;br&gt;
&lt;code&gt;target_compile_features(MyApp PRIVATE cxx_std_17)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add Macros&lt;br&gt;
&lt;code&gt;target_compile_definitions(MyApp PRIVATE VERSION=1.0)&lt;/code&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Sanitizers
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;target_compile_options(MyApp PRIVATE -fsanitize=address)
target_link_options(MyApp PRIVATE -fsanitize=address)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Apply similar for undefined sanitizer.&lt;/p&gt;


&lt;h2&gt;
  
  
  IPO &amp;amp; LTO
&lt;/h2&gt;

&lt;p&gt;Enable link-time optimization:&lt;br&gt;
&lt;code&gt;set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Or per target:&lt;br&gt;
&lt;code&gt;set_property(TARGET MyApp PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)&lt;/code&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Generator Expressions
&lt;/h2&gt;

&lt;p&gt;Inline conditional logic:&lt;br&gt;
&lt;code&gt;$&amp;lt;$&amp;lt;CONFIG:Debug&amp;gt;:-DDEBUG&amp;gt;&lt;/code&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  External Libraries
&lt;/h2&gt;

&lt;p&gt;Git Submodules&lt;br&gt;
Add submodule: &lt;code&gt;git submodule add &amp;lt;repo&amp;gt; external/LibName&lt;/code&gt;&lt;br&gt;
In root CMake:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;add_subdirectory(external/LibName)
target_link_libraries(MyApp PRIVATE LibName)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;FetchContent&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;include(FetchContent)
FetchContent_Declare(
  fmt
  GIT_REPOSITORY https://github.com/fmtlib/fmt.git
  GIT_TAG master
)
FetchContent_MakeAvailable(fmt)
target_link_libraries(MyApp PRIVATE fmt::fmt)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Useful CMake CLI Flags
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;cmake -S . -B build/ -G "Ninja"&lt;/code&gt;&lt;br&gt;
-S: Source directory&lt;br&gt;
-B: Build directory&lt;br&gt;
-G: Generator&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cmake --build build/ --target MyApp&lt;/code&gt;&lt;br&gt;
Builds only MyApp&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cmake --build . --target extLib&lt;/code&gt;&lt;br&gt;
Build external target&lt;/p&gt;


&lt;h2&gt;
  
  
  Dependency Graph
&lt;/h2&gt;

&lt;p&gt;Use Graphviz to visualize target dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cmake --graphviz=graph.dot .
dot -Tpng graph.dot -o graph.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






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

&lt;p&gt;Mastering CMake is about understanding its modular philosophy. Start with small clean builds, add subdirectories and targets gradually, and leverage the power of target_ commands for scalability and control.&lt;/p&gt;




&lt;h2&gt;
  
  
  Useful links:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/ttroy50/cmake-examples" rel="noopener noreferrer"&gt;cmake-examples&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=bsXLMQ6WgIk" rel="noopener noreferrer"&gt;Youtube Link&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://cmake.org/cmake/help/latest/guide/tutorial/index.html" rel="noopener noreferrer"&gt;CMake-DOC&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cmake</category>
      <category>cpp</category>
      <category>c</category>
      <category>build</category>
    </item>
    <item>
      <title>🔧 GitLab CI/CD — The Complete Guide</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Tue, 06 May 2025 15:01:26 +0000</pubDate>
      <link>https://dev.to/vishnutejas/gitlab-cicd-the-complete-guide-3kke</link>
      <guid>https://dev.to/vishnutejas/gitlab-cicd-the-complete-guide-3kke</guid>
      <description>&lt;h3&gt;
  
  
  🚀 Why GitLab CI/CD Over Jenkins and GitHub Actions?
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;GitLab CI/CD&lt;/th&gt;
&lt;th&gt;Jenkins&lt;/th&gt;
&lt;th&gt;GitHub Actions&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Integrated UI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ Built-in&lt;/td&gt;
&lt;td&gt;❌ Plugin-based&lt;/td&gt;
&lt;td&gt;✅ Built-in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Auto DevOps&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ Native support&lt;/td&gt;
&lt;td&gt;❌ Manual&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Kubernetes Deployment&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ First-class&lt;/td&gt;
&lt;td&gt;✅ With plugins&lt;/td&gt;
&lt;td&gt;✅ Beta level&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Security (Secrets, SAST, DAST)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ Built-in&lt;/td&gt;
&lt;td&gt;❌ Manual config&lt;/td&gt;
&lt;td&gt;⚠️ External&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Runners Management&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;✅ Docker/Machine/K8s&lt;/td&gt;
&lt;td&gt;✅ Nodes&lt;/td&gt;
&lt;td&gt;✅ Hosted/self-hosted&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Why choose GitLab CI/CD?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Everything in one place (version control + CI/CD)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Great for GitOps and K8s-based workflows&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easy syntax, strong security model&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;No plugin hell like Jenkins&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  📁 Pipeline Basics
&lt;/h3&gt;

&lt;p&gt;'# Comments'&lt;br&gt;
Use # to write inline documentation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# This job builds the project
build:
  script:
    - echo "Compiling..."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;stages&lt;br&gt;
Defines the execution order of jobs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stages:
  - build
  - test
  - deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;stage&lt;br&gt;
Assigns a job to a defined stage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;test:
  stage: test
  script: echo "Running tests"

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

&lt;/div&gt;






&lt;p&gt;script&lt;br&gt;
Commands that the job will execute.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;build:
  stage: build
  script:
    - make build

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

&lt;/div&gt;






&lt;p&gt;🔀 Multi-Jobs in a Stage&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;build_app:
  stage: build
  script: make app

build_api:
  stage: build
  script: make api

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

&lt;/div&gt;






&lt;p&gt;⏳ timeout&lt;br&gt;
Job-level timeout.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;test:
  script: run_tests
  timeout: 30 minutes

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

&lt;/div&gt;






&lt;p&gt;📌 needs – Optimizing Pipeline Dependency&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;deploy:
  stage: deploy
  script: deploy.sh
  needs: [build]

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

&lt;/div&gt;



&lt;p&gt;Use when job depends on output from another but not the full stage.&lt;/p&gt;




&lt;p&gt;🧹 before_script and after_script&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;before_script:
  - echo "Setup"

after_script:
  - echo "Cleanup"

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

&lt;/div&gt;



&lt;p&gt;Used globally or at job level for pre/post commands.&lt;/p&gt;




&lt;p&gt;📦 artifacts – Store Build Outputs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;build:
  script: make build
  artifacts:
    paths:
      - dist/
    expire_in: 1 week

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

&lt;/div&gt;






&lt;p&gt;🧬 variables – 5 Levels&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Project-level: via GitLab UI → Settings → CI/CD → Variables&lt;br&gt;
Used across all jobs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Global level:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;variables:
  ENV: production

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Job-level:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;test:
  variables:
    ENV: test
  script: echo $ENV

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Built-in:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;$CI_PIPELINE_ID  and $CI_COMMIT_BRANCH..............&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
From file:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;variables:
  CONFIG: config.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;🛂 only and except (Deprecated → Use rules)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;build:
  script: build.sh
  only:
    - main

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

&lt;/div&gt;






&lt;p&gt;📜 rules, if, and when&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;test:
  script: test.sh
  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: always

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

&lt;/div&gt;






&lt;p&gt;🏃 Run File Inside Script&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;






&lt;p&gt;🔁 workflow – Pipeline Start Conditions&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;workflow:
  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
      when: always
    - when: never
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;🐳 image – Docker Environment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;image: python:3.9

script:
  - pip install -r requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;🔢 Matrix/Loops (via parallel:matrix)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;job:
  stage: test
  parallel:
    matrix:
      - VARIANT: [A, B, C]
  script:
    - echo $VARIANT

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

&lt;/div&gt;






&lt;p&gt;🌐 Multi-Project Pipelines&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;trigger-downstream:
  stage: trigger
  trigger:
    project: other-group/other-project
    branch: main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;📦 Downloading/Packaging in a Pipeline&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;build:
  script:
    - wget https://example.com/app.tar.gz
    - tar -xzf app.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;⏰ Pipeline Scheduling&lt;br&gt;
Go to GitLab UI → CI/CD → Schedules&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: always
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;🏃 GitLab Runner Types&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Runner Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;th&gt;Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Shared Runners&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Maintained by GitLab&lt;/td&gt;
&lt;td&gt;Quick use, limited config&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Group Runners&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Shared by a group&lt;/td&gt;
&lt;td&gt;Org-level control&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Project Runners&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Bound to a project&lt;/td&gt;
&lt;td&gt;Isolation, security&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Docker Executor&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Containers&lt;/td&gt;
&lt;td&gt;Microservices, clean env&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Shell Executor&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Host machine&lt;/td&gt;
&lt;td&gt;Full access needed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Kubernetes Executor&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Pods on K8s&lt;/td&gt;
&lt;td&gt;Cloud-native CI/CD&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>gitlab</category>
      <category>cicd</category>
    </item>
    <item>
      <title>🗃️ Introduction to Database Design: Concepts Every Beginner Should Know</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Fri, 18 Apr 2025 07:19:54 +0000</pubDate>
      <link>https://dev.to/vishnutejas/introduction-to-database-design-concepts-every-beginner-should-know-48fb</link>
      <guid>https://dev.to/vishnutejas/introduction-to-database-design-concepts-every-beginner-should-know-48fb</guid>
      <description>&lt;p&gt;If you're diving into the world of databases and wondering how to structure data efficiently, you're in the right place. In this article, we’ll walk through foundational concepts in database design — from understanding what data is, to topics like normalization and joins. Whether you're building apps, handling data for projects, or prepping for tech interviews, these definitions will be your solid starting point.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What is Data?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Data refers to raw facts, figures, or symbols that have not yet been processed or given context. For example, "23", "Alice", or "2025-04-18" are all data. When processed and organized, data becomes information.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What is a Database?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A Database is an organized collection of data that can be easily accessed, managed, and updated. Think of it as a digital filing system for storing information efficiently.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What is a Relational Database?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A Relational Database organizes data into tables (also known as relations) that are related to each other through keys. This model uses SQL for querying and is based on mathematical set theory and relational algebra.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What is an Entity?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;An Entity is a real-world object or concept about which data is stored in a database. For example: a Student, Book, or Order can be considered entities.&lt;br&gt;
An Entity is also called Tuple, Row and Record.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What are Attributes?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Attributes are the properties or characteristics of an entity. For a Student entity, attributes could be Name, Roll Number, Age, and Class.&lt;br&gt;
The attributes are also called column or field.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What is a Table?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A Table is a collection of rows and columns in a relational database. Each table stores data about a specific entity type.&lt;br&gt;
The table is also called file.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What are Entity Types and Attribute Types?&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Entity Types: A category of entities sharing the same attributes (e.g., Student, Teacher).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attribute Types: Attributes can be:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Simple: Cannot be divided (e.g., Age)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Composite: Can be split (e.g., Full Name)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Derived: Derived from other data (e.g., Age from DOB)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multivalued: Can hold multiple values (e.g., Phone Numbers)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What is DBMS and RDBMS?&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;DBMS (Database Management System): Software used to store and manage data (e.g., MongoDB, Redis).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;RDBMS (Relational DBMS): A DBMS that stores data in tables and supports relationships between them (e.g., MySQL, PostgreSQL, Oracle).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What is SQL?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;SQL (Structured Query Language) is the standard language for interacting with relational databases. It allows you to Create, Read, Update, and Delete data — often abbreviated as CRUD.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What are SQL Languages?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;SQL is divided into sub-languages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;DDL (Data Definition Language): CREATE, ALTER, DROP&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DML (Data Manipulation Language): SELECT, INSERT, UPDATE, DELETE&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DCL (Data Control Language): GRANT, REVOKE&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TCL (Transaction Control Language): COMMIT, ROLLBACK, SAVEPOINT&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 Why Database Design?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Good design ensures:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Efficiency in queries&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data integrity&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalability&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoidance of redundancy and anomalies&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What are Schemas and Types?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A Schema is the blueprint of a database — it defines how data is organized, including tables, columns, data types, and relationships.&lt;/p&gt;

&lt;p&gt;Types of schemas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Logical Schema: High-level design&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Physical Schema: Storage-level design&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;View Schema: Customized user perspectives&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 Naming Convention&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Use clear, consistent names in lowercase with underscores:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tables: student_data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Columns: first_name, created_at Avoid spaces, reserved keywords, and overly complex names.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What are Data Types?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Each column has a data type which defines the kind of data it holds. Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;INT for integers&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;VARCHAR(n) for text&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DATE, BOOLEAN, FLOAT, etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What is Data Integrity and its Types?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Data Integrity ensures the accuracy and consistency of data. Types include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Entity Integrity: Primary keys must be unique and not null&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Referential Integrity: Foreign keys must refer to valid rows&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Domain Integrity: Data must be valid for its field (e.g., age must be a number)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What are Atomic Values?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Atomic values mean that each field should contain a single, indivisible value — not a list or multiple items. This is a core rule of First Normal Form (1NF).&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 What is Normalization?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Normalization is the process of organizing data to reduce redundancy. It involves breaking down tables into smaller ones and establishing relationships.&lt;/p&gt;

&lt;p&gt;Common forms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;1NF (First Normal Form): Eliminate repeating groups&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2NF: Remove partial dependency&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;3NF: Remove transitive dependency&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;🔗 Relationships in a Relational Database&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Relationships define how tables (entities) in a database are connected to each other. Understanding relationships is key to designing normalized and efficient databases. There are three main types of relationships:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📘 One-to-One (1:1) Relationship&lt;/strong&gt;&lt;br&gt;
In a One-to-One relationship, a row in Table A is related to only one row in Table B, and vice versa.&lt;br&gt;
✅ Example Design:&lt;/p&gt;

&lt;p&gt;Table: User&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;user_id (Primary Key)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;username&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Table: UserProfile&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;profile_id (Primary Key)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;user_id (Foreign Key referencing User.user_id)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;bio&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;avatar_url&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each user has exactly one profile, and each profile belongs to one user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📘 One-to-Many (1:N) Relationship&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In a One-to-Many relationship, a row in Table A can relate to multiple rows in Table B, but each row in Table B relates to only one row in Table A.&lt;/p&gt;

&lt;p&gt;✅ Example Design:&lt;br&gt;
Table: Customer&lt;/p&gt;

&lt;p&gt;customer_id (Primary Key)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
name&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Table: Order&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;order_id (Primary Key)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;customer_id (Foreign Key referencing Customer.customer_id)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;order_date&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;total_amount&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One customer can place many orders, but each order belongs to one customer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📘 Many-to-Many (M:N) Relationship&lt;/strong&gt;&lt;br&gt;
In a Many-to-Many relationship, multiple rows in Table A relate to multiple rows in Table B. This is implemented using a junction (join) table.&lt;/p&gt;

&lt;p&gt;✅ Example Design:&lt;br&gt;
Table: Student&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;student_id (Primary Key)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;name&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Table: Course&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;course_id (Primary Key)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;course_name&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Table: StudentCourse (Join Table)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;student_id (Foreign Key referencing Student.student_id)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;course_id (Foreign Key referencing Course.course_id)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A student can enroll in many courses, and a course can have many students.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🔑 What is a Primary Key?&lt;/strong&gt;&lt;br&gt;
A Primary Key is a column (or set of columns) that uniquely identifies each record in a table.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It must be unique&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It cannot be null&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A table can have only one primary key&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;🔗 What is a Foreign Key?&lt;/strong&gt;&lt;br&gt;
A Foreign Key is a column that creates a relationship between two tables. It refers to the primary key in another table.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It ensures referential integrity&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It can accept nulls (unless otherwise restricted)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;will be continue&lt;/p&gt;

</description>
      <category>database</category>
      <category>sql</category>
      <category>nosql</category>
    </item>
    <item>
      <title>Mastering Git: The Ultimate Developer's Guide to Version Control</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Thu, 17 Apr 2025 15:20:28 +0000</pubDate>
      <link>https://dev.to/vishnutejas/mastering-git-the-ultimate-developers-guide-to-version-control-2l5n</link>
      <guid>https://dev.to/vishnutejas/mastering-git-the-ultimate-developers-guide-to-version-control-2l5n</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;What is Git? What is Version Control?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Git is a distributed version control system (VCS) designed to track changes in source code during software development. It allows multiple developers to work on the same project simultaneously without interfering with each other's work.&lt;/p&gt;

&lt;p&gt;Version control, in general, is the practice of tracking and managing changes to software code over time. It allows developers to revert to previous versions, collaborate effectively, and maintain the integrity of their codebase.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Types of Version Control and Difference Between Them&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Centralized Version Control (CVCS):&lt;/strong&gt; A system where the version history is stored on a central server, and developers access this repository to make changes. Examples include Subversion (SVN) and Perforce. The main issue is that if the central server goes down, no one can access the version history or make changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Distributed Version Control (DVCS):&lt;/strong&gt; Systems like Git, where each developer has a complete copy of the repository, including its history, on their local machine. This allows for greater flexibility and resilience. Git is an example of a DVCS, and it doesn't rely on a central server for basic operations, allowing offline work and better collaboration.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Git Config – Global, Local, and System Config&lt;/strong&gt;&lt;br&gt;
Git provides three types of configuration levels to control settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Global Config: This configuration applies to all repositories of the current user. It's stored in the user's home directory &lt;br&gt;
(~/.gitconfig or ~/.config/git/config).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Local Config: This configuration applies only to a single repository. It is stored in the .git directory of the repository &lt;br&gt;
(.git/config).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;System Config: This configuration applies to all users on the system and is stored in the system's Git config file, usually located at /etc/gitconfig.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;strong&gt;Git Config Command to View&lt;/strong&gt;&lt;br&gt;
To view the configuration values set at different levels, you can use the following commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Global Config:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global --list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Local Config:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --local --list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;System Config:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --system --list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;To view all configuration levels, you can use:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;Git Workflow Overview (Working Directory, Staging Area, Repository)&lt;/strong&gt;&lt;br&gt;
Git workflow involves three main areas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Working Directory: The directory where files are modified. This is where you make changes to your files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Staging Area (Index): This is where files are prepared before being committed. It allows you to decide which changes to include in the next commit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Repository (Git Directory): The .git directory where the full history and configuration of the project are stored. This is where the commits are made and tracked.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;strong&gt;Creating a Repository&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;git init: Initializes a new empty Git repository in the current directory.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;git clone: Creates a local copy of an existing remote repository. It downloads all the files, commits, branches, and history.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone &amp;lt;repository_url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;Checking Status&lt;/strong&gt;&lt;br&gt;
To check the current state of your repository, including which files have been modified or are staged, use:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This command will show you the differences between your working directory, the staging area, and the repository.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Adding and Committing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;git add: Adds changes in the working directory to the staging area, preparing them to be committed.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git add &amp;lt;file_name&amp;gt;
git add .  # Adds all changes

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;git commit: Records the changes in the staging area to the repository with a commit message.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit -m "Commit message"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;Viewing History&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;git log: Displays the commit history with commit hashes, authors, dates, and messages.
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;git show: Displays detailed information about a specific commit.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git show &amp;lt;commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;git diff: Shows the differences between the working directory and the staging area or between commits.
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;Reverse of Git Workflow (Working Directory to Staging Area and Staging Area to Repository)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From Repository to Staging Area: You can undo a commit and move the changes back to the staging area using:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset --soft HEAD^
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will reset the repository to the previous commit but keep the changes in the staging area.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;From Staging Area to Working Directory: If you want to unstage changes (move them back to the working directory without losing them):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset &amp;lt;file_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will unstage a specific file but leave it in the working directory.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Branching and Merging&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Git branches allow developers to work on new features or bug fixes in isolation from the main production code. Branching is a powerful feature that enables parallel development, experimentation, and clean merging of code.&lt;/p&gt;

&lt;p&gt;Merging is the process of integrating changes from one branch into another. Usually, changes from a feature branch are merged into the main branch once the feature is complete.&lt;/p&gt;




&lt;p&gt;Creating and Switching Branches&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new branch using:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Switch to another branch using:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Or using the modern alternative (since Git 2.23+):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git switch &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Create and switch in one step:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b &amp;lt;branch_name&amp;gt;
or
git switch -c &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;Merging Branches&lt;/strong&gt;&lt;br&gt;
To merge changes from one branch into the current branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git merge &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command applies the changes from the specified branch into the branch you're currently on.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Fast-forward vs. 3-way Merge&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Fast-forward Merge: If there have been no changes on the base branch since the feature branch was created, Git will simply move the pointer forward to include the new commits.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*---*---*   (main)
         \
          *---*---* (feature)

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

&lt;/div&gt;



&lt;p&gt;After fast-forward merge:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*---*---*---*---* (main)

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;3-Way Merge:
If both branches have diverged, Git uses a 3-way merge to combine changes. It compares the common ancestor with both branches and creates a new commit to reconcile them.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Merge Conflicts and Resolving Them&lt;/strong&gt;&lt;br&gt;
A merge conflict occurs when Git is unable to automatically merge changes due to overlapping edits on the same lines in the same file.&lt;/p&gt;

&lt;p&gt;When this happens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Git will mark the conflict in the file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Manually edit the file to resolve the conflict.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After resolving the conflict, do add and commit again.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;strong&gt;git stash – Save and Reapply Work&lt;/strong&gt;&lt;br&gt;
The git stash command allows you to temporarily save changes that you don’t want to commit immediately. It's helpful when you need to switch branches or pull updates without committing unfinished work.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stash current changes:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;List all stashes:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Apply the most recent stash (and keep it in the stash list):
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash apply
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Apply and remove the stash from the list:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash pop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Apply a specific stash:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash apply stash@{2}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Drop a stash:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash drop stash@{0}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Clear all stashes:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git stash clear
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Adding Remotes (git remote add)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A remote is a reference to a repository hosted elsewhere (typically on GitHub, GitLab, Bitbucket, etc.). You can connect your local repository to a remote to collaborate and share code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Add a remote repository:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote add origin &amp;lt;remote_repository_url&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;- List all remotes:&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;git remote -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Rename a remote:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote rename origin upstream
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Remove a remote:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git remote remove origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Pushing Changes (git push)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;After committing locally, you need to push the changes to a remote repository so others can access them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Push to the default remote (origin) and current branch:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Push a specific branch to a remote:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Push all local branches to origin:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push --all origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Push with upstream tracking (first-time push):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push -u origin &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Pulling Changes (git pull)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The git pull command fetches and integrates changes from a remote repository into your current branch. It's a combination of git fetch and git merge.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pull latest changes from origin:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git pull origin &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If your current branch tracks a remote branch, simply:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Fetching Changes (git fetch)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The git fetch command downloads commits, files, and refs from a remote repository without merging them into your working branch.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fetch from origin:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git fetch origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After fetching, you can compare or merge changes manually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git merge origin/&amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;git fetch is a safe way to see what others have pushed without touching your current work.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Tracking Branches&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A tracking branch is a local branch that is connected to a remote branch. This relationship makes commands like git push and git pull more convenient.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a tracking branch manually:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b &amp;lt;local_branch&amp;gt; origin/&amp;lt;remote_branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Set upstream while pushing:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push -u origin &amp;lt;branch_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Check which remote branch your local branch is tracking:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch -vv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Change the upstream branch:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch --set-upstream-to=origin/&amp;lt;remote_branch&amp;gt; &amp;lt;local_branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Git Tags (git tag, git tag -a)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Tags are used to mark specific points in history as important — typically to label releases (v1.0.0, v2.0.1, etc.).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;List all tags:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a lightweight tag:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git tag &amp;lt;tag_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Create an annotated tag:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git tag -a &amp;lt;tag_name&amp;gt; -m "Tag message"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Tag a specific commit:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git tag -a &amp;lt;tag_name&amp;gt; &amp;lt;commit_hash&amp;gt; -m "Message"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Push tags to remote:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin &amp;lt;tag_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Push all tags:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin --tags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Delete a tag locally:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git tag -d &amp;lt;tag_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Delete a remote tag:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push origin --delete &amp;lt;tag_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Reverting Changes (git revert, git reset)&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;git revert: Safely undoes a commit by creating a new commit that reverses the changes. It preserves history.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git revert &amp;lt;commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;git reset: Moves the HEAD and optionally resets the index (staging area) and working directory. Can erase commits if used carelessly.
Soft (keep changes staged):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset --soft &amp;lt;commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Mixed (unstage changes):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset --mixed &amp;lt;commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hard (discard everything):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset --hard &amp;lt;commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Difference Between reset, revert, checkout&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Effect on Commits&lt;/th&gt;
&lt;th&gt;Effect on Working Directory&lt;/th&gt;
&lt;th&gt;Safe?&lt;/th&gt;
&lt;th&gt;Usage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;reset&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Removes commits&lt;/td&gt;
&lt;td&gt;Optional (hard resets files)&lt;/td&gt;
&lt;td&gt;❌ Risky&lt;/td&gt;
&lt;td&gt;Clean up local history before pushing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;revert&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Adds new commit&lt;/td&gt;
&lt;td&gt;Leaves files as-is&lt;/td&gt;
&lt;td&gt;✅ Very Safe&lt;/td&gt;
&lt;td&gt;Undo changes in a shared/public branch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;checkout&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Switches branches or restores files&lt;/td&gt;
&lt;td&gt;Overwrites working directory files&lt;/td&gt;
&lt;td&gt;⚠️ Safe (with caution)&lt;/td&gt;
&lt;td&gt;Restore files or move between branches&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Rewriting History&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
Modify the most recent commit (message or contents):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git commit --amend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is useful when you forgot to add a file or want to edit the commit message.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rebase allows you to replay commits from one branch onto another, enabling a clean linear history.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git rebase &amp;lt;base_branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Apply a specific commit from one branch onto another:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git cherry-pick &amp;lt;commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is useful to copy fixes or features without merging the entire branch.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Cleaning Up (git clean)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Removes untracked files and directories from your working directory.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dry run (see what will be deleted):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clean -n
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Delete untracked files:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clean -f
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Delete untracked directories too:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clean -fd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚠️ Use this command with care — it permanently deletes files not tracked by Git.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Detached HEAD&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A detached HEAD state means you're not on any branch — instead, you're pointing directly to a commit.&lt;/p&gt;

&lt;p&gt;This happens when you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout &amp;lt;commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can view, explore, or test changes, but any commits made now won’t belong to any branch unless you create one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a branch from detached HEAD:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b new-branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is useful for reviewing or reverting specific historical commits without affecting branches.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;git log with Options&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The git log command shows the commit history of the repository. It’s highly customizable using flags.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic log:
&lt;/li&gt;
&lt;/ul&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Compact one-line per commit:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --oneline
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Show graph of branches and merges:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --graph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Decorate with branch and tag names:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --decorate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Combine all (graph, oneline, decorate):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --oneline --graph --decorate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Limit the number of commits:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log -n 5
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Show commits by a specific author:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --author="Author Name"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Filter commits by date:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --since="2 weeks ago"
git log --after="2024-01-01" --before="2024-12-31"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;View changes made in each commit:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log -p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;git blame – Who Changed What, When&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;git blame shows who last modified each line of a file. It’s useful for tracking down when a line of code was added or changed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basic usage:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git blame &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Ignore whitespace changes:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git blame -w &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Blame a file as of a specific commit:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git blame &amp;lt;commit_hash&amp;gt; -- &amp;lt;file&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;git bisect – Find the Bug&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;git bisect helps you find the commit that introduced a bug by using binary search between a known good and bad commit.&lt;br&gt;
Steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Start bisect:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git bisect start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
Mark the bad (buggy) commit:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git bisect bad
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
Mark the good (working) commit:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git bisect good &amp;lt;commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
Git checks out a commit halfway between. You test it, and mark it as:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git bisect good
git bisect bad
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Continue until Git pinpoints the exact commit that introduced the bug.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Exit bisect mode:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git bisect reset
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;git reflog – Recover Lost Commits&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The reflog records all movements of your HEAD — even commits not visible in git log. If you've lost a branch, a commit, or reset hard by mistake, git reflog can rescue you.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Show all recent HEAD changes:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reflog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Restore a lost commit: Find its hash in the reflog and reset or checkout:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout &amp;lt;commit_hash&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Recover a deleted branch: If you deleted a branch and want to restore it:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout -b &amp;lt;branch_name&amp;gt; &amp;lt;commit_hash_from_reflog&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Undo a hard reset:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git reset --hard &amp;lt;commit_hash_from_reflog&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Submodules and Subtrees&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Both let you include one Git repository inside another.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;🧩 Git Submodules&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Track external repositories as subfolders.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You need to init/update them manually.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git submodule add &amp;lt;repo_url&amp;gt; &amp;lt;path&amp;gt;
git submodule init
git submodule update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;🌳 Git Subtrees&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Merge another repository directly into a subdirectory of your project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Easier to manage compared to submodules.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git subtree add --prefix=&amp;lt;dir&amp;gt; &amp;lt;repo_url&amp;gt; &amp;lt;branch&amp;gt; --squash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;To update later:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git subtree pull --prefix=&amp;lt;dir&amp;gt; &amp;lt;repo_url&amp;gt; &amp;lt;branch&amp;gt; --squash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;More Git magic coming soon — stay tuned for advanced workflows, GitOps, and real-world use cases!&lt;/p&gt;

</description>
      <category>git</category>
    </item>
    <item>
      <title>Mastering Linux File Permissions: The Ultimate Guide.</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Tue, 15 Apr 2025 08:59:28 +0000</pubDate>
      <link>https://dev.to/vishnutejas/mastering-linux-file-permissions-the-ultimate-guide-4223</link>
      <guid>https://dev.to/vishnutejas/mastering-linux-file-permissions-the-ultimate-guide-4223</guid>
      <description>&lt;p&gt;Linux file permissions can feel cryptic at first, but once you break them down, they’re not only simple — they’re powerful. Whether you're building systems, writing scripts, or deploying code, understanding how to control file access is a must-have skill. This guide will walk you through everything you need to know.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Why File Permissions Matter&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Linux is a multi-user system. Proper permissions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Keep your system secure&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Prevent accidental or malicious changes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Allow collaboration without compromising safety&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Understanding rwx and User Classes&lt;/strong&gt;&lt;br&gt;
Permissions are shown as:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-rwxr-xr--&lt;/code&gt;&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First char: - (file) or d (directory)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next 3: rwx for User (owner)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next 3: r-x for Group&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Last 3: r-- for Others&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;User Classes&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;u = User (owner)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;g = Group&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;o = Others&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;a = All (u+g+o)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Permission Types&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;r = Read&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;w = Write&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;x = Execute&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-= No permission&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Viewing File Permissions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Using ls&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ls -l /etc/passwd
-rw-r--r-- 1 root root 2871 Aug 22 14:43 /etc/passwd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using stat&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stat /etc/shadow
Access: (0640/-rw-r-----)  Uid: (0/root)   Gid: (42/shadow)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






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

&lt;p&gt;Symbolic (Relative) Mode&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+x file.txt        # Add execute for user
chmod g-w file.txt        # Remove write from group
chmod o-r file.txt        # Remove read from others
chmod a+r file.txt        # Add read for all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;Octal (Absolute) Mode&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;User&lt;/th&gt;
&lt;th&gt;Group&lt;/th&gt;
&lt;th&gt;Other&lt;/th&gt;
&lt;th&gt;Octal&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;rwx&lt;/td&gt;
&lt;td&gt;rwx&lt;/td&gt;
&lt;td&gt;rwx&lt;/td&gt;
&lt;td&gt;777&lt;/td&gt;
&lt;td&gt;&lt;code&gt;chmod 777 file.txt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Full permissions to everyone&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rwx&lt;/td&gt;
&lt;td&gt;r-x&lt;/td&gt;
&lt;td&gt;r-x&lt;/td&gt;
&lt;td&gt;755&lt;/td&gt;
&lt;td&gt;&lt;code&gt;chmod 755 file.txt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Owner: all, Others: read/exec&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;rw-&lt;/td&gt;
&lt;td&gt;r--&lt;/td&gt;
&lt;td&gt;r--&lt;/td&gt;
&lt;td&gt;644&lt;/td&gt;
&lt;td&gt;&lt;code&gt;chmod 644 file.txt&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Owner: read/write, rest: read&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;Setting Permissions from Another File&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;chmod --reference=file1 file2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Recursive Permissions&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;chmod -R u+rw,o-rwx mydir/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Special Permissions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;SUID (Set User ID)&lt;br&gt;
Executes file with owner’s privileges.&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 file
chmod 4755 file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;ls -l /usr/bin/umount
-rwsr-xr-x 1 root root 39144 /usr/bin/umount
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SGID (Set Group ID)&lt;br&gt;
Runs with group’s privileges, or maintains group ownership in directories.&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 dir
chmod 2750 dir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sticky Bit&lt;br&gt;
Only file owner can delete their files in shared directories.&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 dir
chmod 1777 dir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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;ls -ld /tmp
drwxrwxrwt 10 root root 4096 /tmp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;UMASK: Default Permissions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;View Current UMASK&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Set New UMASK&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;How it Works&lt;br&gt;
UMASK subtracts permissions from 666 (files) or 777 (dirs).&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Ownership Commands&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Change Owner&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chown new_user file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change Group&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chgrp new_group file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change Both&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
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Recursive Ownership Change&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chown -R user:group dir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Bonus: File Attributes (Advanced Layer)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;View Attributes&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Change Attributes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chattr +i file   # Make file immutable
sudo chattr -i file   # Make it editable again
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;Cheat Sheet Summary&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;chmod → change permissions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;chown / chgrp → change ownership&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;umask → set default permissions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ls -l / stat → view permissions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;+x, -w, a+r → symbolic changes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;644, 755, 777 → octal changes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SUID, SGID, Sticky Bit → special bits&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




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

&lt;p&gt;Linux permissions are a superpower once you understand the logic. Master these commands, practice regularly, and you’ll never get caught off-guard by a “Permission denied” again.&lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>💥 Master Jenkins Pipelines in One Go – With a Universal Jenkinsfile Template</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Tue, 15 Apr 2025 07:51:13 +0000</pubDate>
      <link>https://dev.to/vishnutejas/master-jenkins-pipelines-in-one-go-with-a-universal-jenkinsfile-template-4ia</link>
      <guid>https://dev.to/vishnutejas/master-jenkins-pipelines-in-one-go-with-a-universal-jenkinsfile-template-4ia</guid>
      <description>&lt;p&gt;Whether you're a DevOps engineer, backend developer, or automation enthusiast, mastering Jenkins pipelines is a must. In this guide, we’ll break down everything you need to know to write powerful, flexible Jenkins pipelines using Groovy — all in one place. You'll also get a universal Jenkinsfile that you can use across projects and tweak to your needs.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;🚀 What is a Jenkinsfile?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A Jenkinsfile is a text file that contains the definition of a Jenkins pipeline and is checked into your source control (GitHub, GitLab, Bitbucket, etc). Instead of configuring jobs in the Jenkins UI, you define everything as code – which makes it version-controlled, repeatable, and collaborative.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;🧠 Declarative vs Scripted Pipeline: What’s the Difference?&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Declarative&lt;/th&gt;
&lt;th&gt;Scripted&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Structured (block-based)&lt;/td&gt;
&lt;td&gt;Freestyle (Groovy code)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Readability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Easier to read and write&lt;/td&gt;
&lt;td&gt;More flexible, less readable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Groovy Knowledge&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Minimal required&lt;/td&gt;
&lt;td&gt;Moderate to advanced Groovy needed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Recommended For&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Most users/projects&lt;/td&gt;
&lt;td&gt;Complex, dynamic logic&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📚 Groovy Concepts You Need to Know for Jenkins Pipelines&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Jenkins pipelines are written in Groovy, but you only need a subset of it:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ Variables&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;def name = "Jenkins"

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✅ String Interpolation&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;echo "Hello ${name}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✅ Lists &amp;amp; Maps&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;def servers = ["web1", "web2"]
def config = [env: "prod", region: "us"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✅ Conditionals &amp;amp; Loops&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;if (env == "prod") {
    echo "Production deploy"
}

servers.each { s -&amp;gt; echo "Deploying to ${s}" }

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✅ Functions&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;def greet(name) {
    echo "Hi ${name}"
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✅ Closures&lt;/strong&gt;&lt;br&gt;
Used behind the scenes with blocks like steps {} and stage {}.&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;🧱 Jenkins Declarative Pipeline Concepts (Explained)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;pipeline { }&lt;br&gt;
Root block that wraps everything.&lt;/p&gt;

&lt;p&gt;agent&lt;br&gt;
Defines where the pipeline runs (any, docker, specific label).&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;stages { } &amp;amp; stage { }&lt;br&gt;
Defines the steps in your CI/CD lifecycle.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stages {
    stage('Build') {
        steps {
            echo "Building..."
        }
    }
}

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

&lt;/div&gt;



&lt;p&gt;steps { }&lt;br&gt;
Actual shell commands or Jenkins steps.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;steps {
    sh 'npm install'
    echo "Done"
}

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

&lt;/div&gt;



&lt;p&gt;environment&lt;br&gt;
Set environment variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;environment {
    NODE_ENV = "production"
    VERSION = "${env.BUILD_ID}"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;when&lt;br&gt;
Conditional execution of stages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;when {
    branch 'main'
}

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

&lt;/div&gt;



&lt;p&gt;post&lt;br&gt;
Defines actions after success/failure/always.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;post {
    success { echo "✔️ Success" }
    failure { echo "❌ Failed" }
    always  { cleanWs() }
}

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

&lt;/div&gt;



&lt;p&gt;parameters&lt;br&gt;
Accept runtime input to your pipeline.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;parameters {
    string(name: 'DEPLOY_ENV', defaultValue: 'staging', description: 'Choose env')
    booleanParam(name: 'RUN_TESTS', defaultValue: true, description: 'Run tests?')
}

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

&lt;/div&gt;



&lt;p&gt;credentials&lt;br&gt;
Access stored secrets securely.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;withCredentials([usernamePassword(credentialsId: 'git-creds', usernameVariable: 'USER', passwordVariable: 'PASS')]) {
    sh 'git push https://${USER}:${PASS}@repo.git'
}

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

&lt;/div&gt;



&lt;p&gt;tools&lt;br&gt;
Preinstalled tools like JDK, Maven, etc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tools {
    maven 'Maven 3.8.1'
}

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

&lt;/div&gt;



&lt;p&gt;script&lt;br&gt;
For advanced Groovy logic inside declarative pipelines.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;script {
    def result = "build_${env.BUILD_NUMBER}"
    echo result
}

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

&lt;/div&gt;






&lt;p&gt;🌐 Universal Jenkinsfile Template (Copy-Paste &amp;amp; Customize)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipeline {
    agent any

    options {
        timeout(time: 15, unit: 'MINUTES')
        buildDiscarder(logRotator(numToKeepStr: '10'))
        skipDefaultCheckout()
    }

    parameters {
        string(name: 'DEPLOY_ENV', defaultValue: 'staging', description: 'Target environment')
        booleanParam(name: 'RUN_TESTS', defaultValue: true, description: 'Run tests before build')
    }

    environment {
        APP_NAME = "universal-app"
        BUILD_TAG = "${env.BUILD_NUMBER}-${new Date().format('yyyyMMdd-HHmm')}"
    }

    stages {
        stage('Init') {
            steps {
                echo "🚀 Starting pipeline for ${APP_NAME}"
                checkout scm
            }
        }

        stage('Install Dependencies') {
            steps {
                script {
                    if (fileExists('package.json')) {
                        echo "Node project detected"
                        sh 'npm install'
                    } else if (fileExists('requirements.txt')) {
                        echo "Python project detected"
                        sh 'pip install -r requirements.txt'
                    } else {
                        echo "Unknown project type"
                    }
                }
            }
        }

        stage('Test') {
            when {
                expression { return params.RUN_TESTS }
            }
            steps {
                script {
                    try {
                        sh 'npm test || echo "Tests skipped/failing gracefully"'
                    } catch (e) {
                        echo "Test failure ignored for now"
                    }
                }
            }
        }

        stage('Build') {
            steps {
                script {
                    echo "🛠️ Building ${APP_NAME} - ${BUILD_TAG}"
                    sh 'mkdir -p build &amp;amp;&amp;amp; echo "Build successful" &amp;gt; build/status.txt'
                }
            }
        }

        stage('Deploy') {
            when {
                anyOf {
                    branch 'main'
                    expression { params.DEPLOY_ENV == 'production' }
                }
            }
            steps {
                echo "🚀 Deploying to ${params.DEPLOY_ENV}"
                sh './deploy.sh ${params.DEPLOY_ENV} || echo "Deploy script not found"'
            }
        }

        stage('Parallel Quality Checks') {
            parallel {
                stage('Lint') {
                    steps {
                        echo "🔍 Linting code..."
                        sh 'sleep 3'
                    }
                }
                stage('Security Scan') {
                    steps {
                        echo "🔐 Running security scan..."
                        sh 'sleep 3'
                    }
                }
            }
        }
    }

    post {
        success {
            echo "✅ Pipeline completed successfully"
        }
        failure {
            echo "❌ Pipeline failed"
        }
        always {
            echo "🧹 Cleaning up workspace"
            cleanWs()
        }
    }
}

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

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;🎯 Final Thoughts&lt;/strong&gt;&lt;br&gt;
With this article, you now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Understand how Jenkins pipelines work&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Know the key Groovy concepts used inside Jenkins&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Can write and reuse a universal Jenkinsfile&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Are ready to build, test, deploy, and automate like a DevOps pro 🚀&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>jenkins</category>
      <category>pipeline</category>
      <category>groovy</category>
    </item>
    <item>
      <title>🧠 Ultimate Guide to Linux Networking Commands</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Mon, 14 Apr 2025 17:11:54 +0000</pubDate>
      <link>https://dev.to/vishnutejas/ultimate-guide-to-linux-networking-commands-4mko</link>
      <guid>https://dev.to/vishnutejas/ultimate-guide-to-linux-networking-commands-4mko</guid>
      <description>&lt;p&gt;Master the Linux networking essentials with proper command usage, flag explanations, and common troubleshooting tips. Perfect for SysAdmins, DevOps engineers, and Linux learners.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;🖧 Getting Network Interface Information&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
ifconfig – Interface Configuration (Deprecated but still useful)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ifconfig                   # Show info about active interfaces
ifconfig -a               # Show info about all interfaces (active/inactive)
ifconfig enp0s3           # Show info for specific interface

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-a: Show all interfaces&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Displays IPv4, MAC address, TX/RX packets, etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;ul&gt;
&lt;li&gt;ip – Modern replacement for ifconfig
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip address show                  # Show all addresses
ip addr show dev enp0s3          # Show specific device
ip -4 address                    # IPv4 only
ip -6 address                    # IPv6 only
ip link show                     # Show MAC and Layer 2 info
ip link show dev enp0s3

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;address or addr: Shows IP info&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;link: Layer 2 (MAC level) info&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-4: IPv4 only&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-6: IPv6 only&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;🧭 Displaying and Setting Routing Information&lt;br&gt;
route – Legacy command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;route                    # Show routing table
route -n                 # Show numerical IPs only

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;-n: Don't resolve IP to hostnames&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ip route – Modern replacement&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip route show                   # Show routing table
ip route add default via 192.168.0.1
ip route del default

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

&lt;/div&gt;






&lt;p&gt;🧰 Network Interface Control&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Bringing interfaces up/down
ifconfig enp0s3 down
ifconfig enp0s3 up

ip link set enp0s3 down
ip link set enp0s3 up

# Assigning IP addresses
ifconfig enp0s3 192.168.0.222/24 up
ip addr add 192.168.0.112/24 dev enp0s3
ip addr del 192.168.0.111/24 dev enp0s3

# Secondary IP using sub-interface
ifconfig enp0s3:1 10.0.0.1/24

# Gateway changes
route del default gw 192.168.0.1
route add default gw 192.168.0.2

ip route del default
ip route add default via 192.168.0.1

# MAC address change
ip link set dev enp0s3 address 08:00:27:51:05:a3

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

&lt;/div&gt;






&lt;p&gt;⚙️ Netplan – Static Network Config (Ubuntu)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# /etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s3:
      dhcp4: false
      addresses:
        - 192.168.0.20/24
      gateway4: "192.168.0.1"
      nameservers:
        addresses:
          - "8.8.8.8"
          - "8.8.4.4"

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
sudo netplan apply

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

&lt;/div&gt;






&lt;p&gt;🛠️ Network Troubleshooting&lt;br&gt;
Using ping&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ping 8.8.8.8                  # Ping Google DNS
ping -c 5 192.168.0.1         # Send 5 packets
ping -i 0.5 google.com        # Interval of 0.5s

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-c: Count&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-i: Interval&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;🛠️ Troubleshooting Network Issues in Linux&lt;/strong&gt;&lt;br&gt;
When you're facing network issues, here's a step-by-step checklist to diagnose and fix them.&lt;br&gt;
1️⃣ No Internet?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
✅ Check Internet connectivity
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ping 8.8.8.8

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

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;🛠️ If ping fails, check your gateway configuration.&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;2️⃣ DNS Not Resolving?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Test DNS resolution
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ping google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;🔍 If this fails but 8.8.8.8 works, check DNS settings:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resolvectl status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;3️⃣ Interface Down?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
🔎 Check interface status
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip link show
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
🧰 Bring interface up (example: enp0s3)
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ip link set enp0s3 up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




&lt;p&gt;🔐 SSH – Secure Shell&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh -p 22 user@host                # Connect to host
ssh -l user -p 22 host
ssh -v -p 22 user@host             # Verbose mode

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-p, --port&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-l, --login-name&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-v, --verbose&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SSH Daemon Control:&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 status sshd
sudo systemctl restart sshd
sudo systemctl enable sshd

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

&lt;/div&gt;






&lt;p&gt;📤 SCP – Secure Copy&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;scp a.txt user@host:~               # Upload file
scp -P 2222 file.txt user@host:~/   # With custom port
scp -r dir/ user@host:~/            # Recursive directory copy
scp -P 2222 user@host:~/a.txt .     # Download file

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-P: Port&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-r: Recursive&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;🔁 RSYNC – File Synchronization&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rsync -av /src/ /dest/                       # Archive &amp;amp; verbose
rsync -av --delete /src/ /dest/              # Mirror
rsync -av -e ssh /src/ user@host:/dest/      # Over SSH
rsync -av --exclude '*.mp4' /src/ /dest/     # Exclude files

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-a, --archive&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-v, --verbose&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;--delete: Mirror deletions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-e ssh: Use SSH&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;🌐 WGET – Web Download Tool&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;wget https://file.com/sample.iso
wget -c https://file.com/sample.iso             # Resume
wget -P ~/Downloads/ https://file.com/sample    # Set dir
wget --limit-rate=100k -P dir/ URL              # Limit rate
wget -i urls.txt                                # Batch download
wget -b URL &amp;amp;&amp;amp; tail -f wget-log                 # Background
wget --mirror --convert-links http://site.com   # Full site

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

&lt;/div&gt;






&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-c, --continue&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-P, --directory-prefix&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;--limit-rate=&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-b, --background&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-i, --input-file&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;📊 NETSTAT, SS, and LSOF&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;netstat -tupan          # TCP/UDP active ports
ss -tupan               # Faster alternative
lsof                    # List open files
lsof -u user            # By user
lsof -c sshd            # By command
lsof -iTCP -sTCP:LISTEN # TCP listening ports

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-t, --tcp&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-u, --udp&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-a, --all&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-p, --program&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;🔍 NMAP – Network Scanner&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -sS 192.168.0.1               # SYN scan
nmap -sT 192.168.0.1               # TCP connect
nmap -p- 192.168.0.1               # All ports
nmap -sV -p 22,80 192.168.0.1      # Version scan
nmap -O 192.168.0.1                # OS detection
nmap -A 192.168.0.1                # Full scan
nmap -iL hosts.txt -oN report.txt  # Input file + save

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-sS: SYN scan&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-sT: TCP connect&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-sV: Version detection&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-O: OS detection&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-A: Aggressive scan&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-iL: Input from file&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-oN: Normal output file&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>network</category>
      <category>linux</category>
    </item>
    <item>
      <title>🧠 Mastering Linux Processes: Viewing, Managing, and Killing Like a Pro 🧨</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Sat, 12 Apr 2025 11:56:06 +0000</pubDate>
      <link>https://dev.to/vishnutejas/mastering-linux-processes-viewing-managing-and-killing-like-a-pro-32db</link>
      <guid>https://dev.to/vishnutejas/mastering-linux-processes-viewing-managing-and-killing-like-a-pro-32db</guid>
      <description>&lt;p&gt;Understanding and controlling processes is a key skill for every Linux user—especially for DevOps, system administrators, or anyone building backend systems. This guide breaks down everything you need to know about processes, their types, real-time monitoring, and how to kill them—with commands, outputs, flags, and scenarios.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;🔍 What is a Process in Linux?&lt;/strong&gt;&lt;br&gt;
A process is an instance of a program that's being executed. Every command you run, service started, or script executed becomes a process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧬 Process Properties&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;PID: Process ID&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PPID: Parent Process ID&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;UID/GID: User/Group ID of the owner&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;TTY: Terminal associated with the process&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CMD: Command used to start the process&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;STATE: (e.g., R - Running, S - Sleeping, Z - Zombie)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;⚙️ Process Types&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Foreground&lt;/td&gt;
&lt;td&gt;Runs in the terminal&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Background&lt;/td&gt;
&lt;td&gt;Runs behind the scenes (appended with &lt;code&gt;&amp;amp;&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Daemon&lt;/td&gt;
&lt;td&gt;System-level background service&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Zombie&lt;/td&gt;
&lt;td&gt;Terminated, but waiting for parent to read its exit status&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Orphan&lt;/td&gt;
&lt;td&gt;Parent exited before the process; adopted by &lt;code&gt;init&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;🧵 Task vs Process&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A task refers to a kernel-level thread or unit of scheduling.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A process may contain multiple tasks (threads).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;🔍 Is It a Shell Built-in or Executable?&lt;/strong&gt;
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type cd     # =&amp;gt; cd is a shell built-in
type rm     # =&amp;gt; rm is /usr/bin/rm

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

&lt;/div&gt;


&lt;p&gt;This helps in understanding performance and behavior. Built-ins run faster and don’t spawn a new process.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;👁️ Process Viewing Commands&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ps – Snapshot of Processes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ps                 # Processes in current shell
ps -ef             # All processes (full format)
ps aux             # BSD style output
ps aux | less      # Paged view
ps aux --sort=%mem | less  # Sorted by memory
ps -ef --forest    # Tree view
ps -f -u username  # User-specific processes

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;pgrep – Search for Processes by Name&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;pgrep -l sshd     # Shows PID and name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;pstree – ASCII Tree of Running Processes&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;pstree            # Tree structure
pstree -c         # Don’t merge branches with same name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🆚 ps vs pgrep vs pstree&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ps&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;When you want full detail, CPU/mem usage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pgrep&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;When you need just PIDs (scripting, killing)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pstree&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;When visualizing parent-child process hierarchy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;📈 Real-Time Process Monitoring: top and htop&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;top – Classic Real-Time Monitor&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;top
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔤 Key Shortcuts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;h: Help&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;1: CPU per core&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;m: Memory view&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;u: Filter by user&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;x/y: Highlight sort/running processes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&amp;lt; / &amp;gt;: Change sorting column&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;q: Quit&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;📥 Batch Mode Logging:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;top -d 1 -n 3 -b &amp;gt; top_log.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;-d&lt;/td&gt;
&lt;td&gt;Delay between refreshes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-n&lt;/td&gt;
&lt;td&gt;Number of iterations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-b&lt;/td&gt;
&lt;td&gt;Batch mode (non-interactive)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;&lt;strong&gt;htop – Improved, Colorful, Interactive&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;sudo apt install htop
htop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🧭 Navigation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use arrow keys&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;F2 to configure columns&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;F5 for tree view&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;F9 to kill processes&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;F6 to sort&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🆚 top vs htop&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;top&lt;/th&gt;
&lt;th&gt;htop&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Interface&lt;/td&gt;
&lt;td&gt;Text-based&lt;/td&gt;
&lt;td&gt;Colorful UI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Navigation&lt;/td&gt;
&lt;td&gt;Keyboard&lt;/td&gt;
&lt;td&gt;Interactive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tree view&lt;/td&gt;
&lt;td&gt;Manual&lt;/td&gt;
&lt;td&gt;Built-in&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ease of use&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Use htop for interactive analysis, and top -b for logs in scripts or automation.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;💀 Killing Processes&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;kill – Send Signal by PID&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;kill -l              # Lists all signals
kill 1234            # Default SIGTERM (15)
kill -9 1234         # SIGKILL (force kill)
kill -HUP 1234       # Reload (used in daemons)
kill -1 1234         # Same as above
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 Common Signals&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Signal&lt;/th&gt;
&lt;th&gt;Number&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SIGHUP&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Reload configuration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SIGINT&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Interrupt (Ctrl+C)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SIGTERM&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;Graceful termination&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SIGKILL&lt;/td&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;Force kill (cannot be ignored)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;pkill – Kill by Process Name&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pkill firefox
pkill -HUP nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;killall – Kill All by Name&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;pidof + kill&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kill -9 $(pidof nginx)

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

&lt;/div&gt;



&lt;p&gt;🆚 kill vs pkill vs killall&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Works On&lt;/th&gt;
&lt;th&gt;Pros&lt;/th&gt;
&lt;th&gt;When to Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;kill&lt;/td&gt;
&lt;td&gt;PID&lt;/td&gt;
&lt;td&gt;Precise, script-friendly&lt;/td&gt;
&lt;td&gt;When you know the PID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pkill&lt;/td&gt;
&lt;td&gt;Name&lt;/td&gt;
&lt;td&gt;Pattern-based killing&lt;/td&gt;
&lt;td&gt;Dynamic process names&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;killall&lt;/td&gt;
&lt;td&gt;Full name&lt;/td&gt;
&lt;td&gt;Kills all with exact match&lt;/td&gt;
&lt;td&gt;Multiple instances of command&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;🎭 Background Job Management&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sleep 100 &amp;amp;     # Background process
jobs            # List jobs
Ctrl + Z        # Pause foreground job
fg %1           # Resume in foreground
bg %1           # Resume in background
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;👻 nohup – Immune to Hangup (SIGHUP)&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;nohup long_command &amp;amp;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even if the terminal closes, the command keeps running. Output is saved to nohup.out.&lt;/p&gt;

&lt;p&gt;🧪 Real World Use Cases&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Reload SSH server config&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kill -HUP $(pidof sshd)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gracefully stop a Python app&lt;/td&gt;
&lt;td&gt;&lt;code&gt;pkill python&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Log processes every second&lt;/td&gt;
&lt;td&gt;&lt;code&gt;top -b -d 1 -n 10 &amp;gt; usage.log&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kill all background jobs&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;killall sleep&lt;/code&gt; or &lt;code&gt;jobs -p&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prevent process kill on logout&lt;/td&gt;
&lt;td&gt;&lt;code&gt;nohup python server.py &amp;amp;&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;✅ Summary&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ps&lt;/td&gt;
&lt;td&gt;One-time process snapshot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pgrep&lt;/td&gt;
&lt;td&gt;Find PID by name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pstree&lt;/td&gt;
&lt;td&gt;View process hierarchy&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;top/htop&lt;/td&gt;
&lt;td&gt;Real-time monitoring&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;kill&lt;/td&gt;
&lt;td&gt;Terminate process by PID&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;pkill&lt;/td&gt;
&lt;td&gt;Terminate process by name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;killall&lt;/td&gt;
&lt;td&gt;Kill all by command name&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;nohup&lt;/td&gt;
&lt;td&gt;Run processes immune to SIGHUP&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>🦸‍♂️🛠️ The Avengers of Bash: grep, awk, sed, cut &amp; tr Assembled! ⚡🐧💻</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Sat, 12 Apr 2025 11:11:18 +0000</pubDate>
      <link>https://dev.to/vishnutejas/the-avengers-of-bash-grep-awk-sed-cut-tr-assembled-2m89</link>
      <guid>https://dev.to/vishnutejas/the-avengers-of-bash-grep-awk-sed-cut-tr-assembled-2m89</guid>
      <description>&lt;p&gt;🛠️ Bash Power Tools: &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;awk&lt;/code&gt;, &lt;code&gt;sed&lt;/code&gt;, &lt;code&gt;cut&lt;/code&gt;, and &lt;code&gt;tr&lt;/code&gt; Explained with Comparison.&lt;br&gt;
When working in Bash, you’ll come across several powerful text-processing tools. Each of them — &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;awk&lt;/code&gt;, &lt;code&gt;sed&lt;/code&gt;, &lt;code&gt;cut&lt;/code&gt;, and &lt;code&gt;tr&lt;/code&gt; — has a unique role. Here's a deep dive into what each one does, when to use them, and how they compare.&lt;/p&gt;


&lt;h2&gt;
  
  
  📊 Text Processing Tools Comparison Table
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Primary Use&lt;/th&gt;
&lt;th&gt;Works On&lt;/th&gt;
&lt;th&gt;Supports Patterns&lt;/th&gt;
&lt;th&gt;Field/Column Support&lt;/th&gt;
&lt;th&gt;Modifies Text&lt;/th&gt;
&lt;th&gt;Best Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;grep&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Search/filter lines with a pattern&lt;/td&gt;
&lt;td&gt;Full lines&lt;/td&gt;
&lt;td&gt;✅ Regex&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;Search for matching lines (logs, files)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;awk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Field-wise processing + logic&lt;/td&gt;
&lt;td&gt;Line-by-line&lt;/td&gt;
&lt;td&gt;✅ Regex + conditions&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;Column-wise reporting, filtering, summaries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Find &amp;amp; replace, stream editing&lt;/td&gt;
&lt;td&gt;Line-by-line&lt;/td&gt;
&lt;td&gt;✅ Regex&lt;/td&gt;
&lt;td&gt;✅ Limited (via regex)&lt;/td&gt;
&lt;td&gt;✅ Yes&lt;/td&gt;
&lt;td&gt;Replace/edit text in streams/files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cut&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Extract specific fields/characters&lt;/td&gt;
&lt;td&gt;Line-by-line&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✅ Yes (&lt;code&gt;-d&lt;/code&gt;, &lt;code&gt;-f&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;Quickly extract columns by delimiter&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Translate/delete characters&lt;/td&gt;
&lt;td&gt;Char-by-char&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;❌ No&lt;/td&gt;
&lt;td&gt;✅ Yes (chars)&lt;/td&gt;
&lt;td&gt;Replace or remove specific characters&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  💡 When to Use What
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;Use Tool&lt;/th&gt;
&lt;th&gt;Why?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Find lines containing &lt;code&gt;"ERROR"&lt;/code&gt; in logs&lt;/td&gt;
&lt;td&gt;&lt;code&gt;grep&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Simple pattern match&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Replace &lt;code&gt;"localhost"&lt;/code&gt; with &lt;code&gt;"127.0.0.1"&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fast line/text replacement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Convert lowercase to uppercase in a file&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Char-level transformation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Extract usernames from &lt;code&gt;/etc/passwd&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cut&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Fixed delimiter (:) and fields&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Print names and emails from CSV, filter age &amp;gt; 25&lt;/td&gt;
&lt;td&gt;&lt;code&gt;awk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Column-based logic and filtering&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delete 2nd line from a file&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sed '2d'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Line manipulation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Remove digits from a string&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tr -d '0-9'&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Clean unwanted characters&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  🧠 Quick Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Simple&lt;/th&gt;
&lt;th&gt;Powerful&lt;/th&gt;
&lt;th&gt;Script-Friendly&lt;/th&gt;
&lt;th&gt;Supports Logic&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;grep&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;⚠️ Only for matching&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;cut&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;⚠️ Fixed format only&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;⚠️ Char-level only&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;sed&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;⚠️ Basic logic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;awk&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;⚠️&lt;/td&gt;
&lt;td&gt;✅✅&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;✅✅&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;


&lt;h2&gt;
  
  
  ✂️ cut (Extract fields)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Alice,25,Developer,NY" | cut -d ',' -f 1
echo "Bob,30,Manager,LA" | cut -d ',' -f 2,3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧠 awk (Fields + Logic)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Eve,28,Developer,TX" | awk -F ',' '{ print $1, $3 }'
echo "Daniel,35,CEO,CA" | awk -F ',' '$2 &amp;gt; 30 { print $1 " is senior" }'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔤 tr (Character transformations)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "developer" | tr 'a-z' 'A-Z'
echo "Remove123Digits" | tr -d '0-9'
echo "one:two:three" | tr ':' '-'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧹 sed (Stream edit)
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Welcome dev!" | sed 's/dev/developer/'
echo "Line to delete" | sed '1d'
echo "TX" | sed 's/^/[Location] /'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔍 grep – The Pattern Hunter
&lt;/h2&gt;

&lt;p&gt;grep is used to search for lines that match a pattern. It's perfect for filtering logs, outputs, or data streams.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ Basic Examples with echo:&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;echo "Alice,25,Developer,NY" | grep "Developer"
# Output: Alice,25,Developer,NY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;








&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Bob,30,Manager,LA" | grep "Developer"
# Output: (nothing, because it doesn't match)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;








&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Charlie,22,intern,TX" | grep -i "Intern"
# Output: Charlie,22,intern,TX
# -i makes it case-insensitive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;








&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "Daniel,35,CEO,CA" | grep -v "Developer"
# Output: Daniel,35,CEO,CA
# -v inverts the match (shows non-matching lines)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;🧠 Explanation:&lt;br&gt;
grep "pattern" – Matches lines containing pattern.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-i – Case-insensitive match.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-v – Show only lines that don’t match the pattern.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-E – Use extended regular expressions (for advanced patterns).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-o – Show only the matching part of the line.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📌 Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Each of these Bash superheroes has a specialty. Combine them like Unix Avengers and you can process any kind of text or log stream like a pro!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>bash</category>
      <category>cli</category>
      <category>avengers</category>
    </item>
    <item>
      <title>👤 Linux User &amp; Group Management</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Fri, 11 Apr 2025 10:27:10 +0000</pubDate>
      <link>https://dev.to/vishnutejas/linux-user-group-management-i6b</link>
      <guid>https://dev.to/vishnutejas/linux-user-group-management-i6b</guid>
      <description>&lt;p&gt;Want to really understand how Linux handles users and groups? This hands-on guide not only gives you commands — it breaks them down flag by flag, so you know exactly what you're doing.&lt;/p&gt;

&lt;p&gt;Grab your terminal and follow along. Ready? Let’s get started. 🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;📁 Important Files — Know What Powers User Management&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/etc/passwd   # User info: username:x:UID:GID:comment:home:shell
/etc/shadow   # Has (hashed) passwords
/etc/group    # Lists all groups
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;💡 Try:&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 | head -n 3
sudo cat /etc/shadow | head -n 3
cat /etc/group | head -n 3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;🛠️ Create a User with useradd&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;useradd [OPTIONS] username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🔑 Common Flags:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-m → Create a home directory (e.g., /home/username)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-d /custom/path → Set a custom home directory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-s /bin/bash → Set user’s login shell&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-c "comment" → Add a comment (e.g., full name or role)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-G group1,group2 → Add to secondary groups (must already exist)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-g group → Set primary group (must already exist)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;📌 Practical Example:&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 -d /home/john -c "C++ Developer" -s /bin/bash -G sudo,adm john
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-m: Create /home/john&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-d /home/john: Use this as the home directory&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-c "C++ Developer": Store this comment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-s /bin/bash: Set Bash as login shell&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-G sudo,adm: Add to secondary groups&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;➡️ Now set a 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 john
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;🔄 Modify a User with usermod&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;usermod [OPTIONS] username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Useful Flags:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-aG group1,group2 → Append user to new secondary groups&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-s /new/shell → Change default shell&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-d /new/home → Change home dir (-m to move files)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-c → Change comment&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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 plaintext"&gt;&lt;code&gt;sudo usermod -aG docker,developers john
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Explanation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;-a: Append (don’t remove existing groups!)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;-G: Add to docker and developers groups&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;❌ Delete a User with userdel&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo userdel [OPTIONS] username
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Flags:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
-r → Remove user’s home directory and mail spool
Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo userdel -r john
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result: Deletes john + /home/john&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;👥 Group Management with groupadd, groupdel&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;➕ Add a Group:&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;sudo groupadd devops
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;❌ Delete a Group:&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;sudo groupdel devops
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔍 View All Groups:&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;cat /etc/group
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;🔍 Check Group Membership&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;groups           # For current user
groups username  # For another user
id username      # UID, GID, group list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;🧑‍💼 Make a User Admin (Sudo Access)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;On Ubuntu:&lt;br&gt;
&lt;code&gt;sudo usermod -aG sudo john&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;On CentOS:&lt;br&gt;
&lt;code&gt;sudo usermod -aG wheel john&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;🕵️ Monitor Logged-In Users&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;who -H       # Show who is logged in
w            # Who is logged in + what they’re doing
uptime       # Show load, users, system uptime
id           # Show UID, GID, and groups
whoami       # Show your effective user ID
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;📜 Login History&lt;/strong&gt;
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;last             # Recent logins
last -u username # Logins by a specific user
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;✍️ Final Words&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Linux user &amp;amp; group management is must-know stuff for sysadmins, DevOps engineers, and anyone using Linux daily.&lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>🐧 Deep Dive into the Linux File System: A Beginner-Friendly Guide</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Fri, 11 Apr 2025 06:14:10 +0000</pubDate>
      <link>https://dev.to/vishnutejas/deep-dive-into-the-linux-file-system-a-beginner-friendly-guide-43m6</link>
      <guid>https://dev.to/vishnutejas/deep-dive-into-the-linux-file-system-a-beginner-friendly-guide-43m6</guid>
      <description>&lt;p&gt;Linux is known for its powerful file system and command-line tools. Whether you're an aspiring DevOps engineer or just curious about Linux internals, understanding the file system is foundational.&lt;/p&gt;

&lt;p&gt;In this guide, we'll explore everything from the Linux file hierarchy to file manipulation commands.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📁 1. What is the Linux File System?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Linux file system is a structured arrangement for storing and organizing data. Everything in Linux is treated as a file, whether it’s a document, directory, or hardware device.&lt;/p&gt;




&lt;h2&gt;
  
  
  🌲 &lt;strong&gt;2. File Hierarchy System&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Linux follows a hierarchical file structure starting from the root directory &lt;code&gt;/&lt;/code&gt;.&lt;br&gt;
/&lt;br&gt;
├── bin/ → Essential user binaries&lt;br&gt;
  ├── boot/ → Boot loader files &lt;br&gt;
  ├── dev/ → Device files &lt;br&gt;
  ├── etc/ → Configuration files &lt;br&gt;
  ├── home/ → User directories &lt;br&gt;
  ├── lib/ → Essential shared libraries&lt;br&gt;
  ├── tmp/ → Temporary files &lt;br&gt;
  ├── usr/ → User programs &lt;br&gt;
  ├── var/ → Variable data (logs, spool)&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;🛣️ 3. Absolute vs Relative Path&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;📌 Absolute Path&lt;/strong&gt;&lt;br&gt;
An absolute path always starts from the root directory / and points to a file or directory regardless of 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;/home/username/docs/file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;📌 Relative Path&lt;/strong&gt;&lt;br&gt;
A relative path starts from the current directory (denoted by .) and is relative to where you are in the filesystem.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;🔗 4. Hard Links, Inodes, and Symbolic Links&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;📦 Inodes:&lt;/strong&gt;&lt;br&gt;
Every file has an inode storing metadata (permissions, size, timestamps, etc.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔁 Hard Link:&lt;/strong&gt;&lt;br&gt;
Creates another name pointing to the same inode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ln original.txt hardlink.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔗 Symbolic (Soft) Link:&lt;/strong&gt;&lt;br&gt;
Points to the file path, not the inode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ln -s original.txt symlink.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;🛠️ 5. Useful File System Commands&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;📄 ls – List Files&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;ls -l          # Long listing
ls -a          # Include hidden files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🕒 atime, mtime, ctime&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;atime: Last accessed&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;mtime: Last modified&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ctime: Last changed (metadata)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check using:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Update time using:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Check date/time:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔃 Sorting Files&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;ls -lt      # Sort by modified time
ls -lSr     # Sort by size, reverse
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🐈 File Viewing: cat, less, tail, head, watch&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;cat file.txt
less file.txt
tail -f file.txt        # Follow file
head -n 10 file.txt
watch -n 2 ls -l        # Refresh every 2s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;📂 Create Files &amp;amp; Dirs: touch, mkdir&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;touch newfile.txt
mkdir newfolder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;✂️ File Ops: cp, mv, rm, shred&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;cp file1.txt backup/
mv file.txt renamed.txt
rm unwanted.txt
shred -u sensitive.txt  # Secure delete
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔗 Pipes and Word Count: |, wc&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;cat file.txt | wc -l
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;➕ Redirection: &amp;gt;, &amp;gt;&amp;gt;, 2&amp;gt;, &amp;amp;&amp;gt;, cut, tee&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;echo "Hello" &amp;gt; file.txt       # Overwrite
echo "World" &amp;gt;&amp;gt; file.txt      # Append
command 2&amp;gt; error.log          # Errors only
command &amp;amp;&amp;gt; all.log            # Stdout + stderr
cut -d':' -f1 /etc/passwd
command | tee output.log      # View + save
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔍 which &amp;amp; plocate&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;which bash
plocate file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔎 find with exec&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;find . -name "*.log" -exec rm {} \;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔍 grep – Search Text&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;grep "error" logfile.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔤 strings – Extract printable text from binary&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;strings binaryfile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;🔁 Compare Files: cmp, diff, sha256sum&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;cmp file1.txt file2.txt
diff file1.txt file2.txt
sha256sum file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;✍️ VIM Editor Basics&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Open file:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;i: Insert mode&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Esc: Exit insert&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;:w: Save&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;:q: Quit&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;:wq: Save and quit&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;📦 Archiving: tar and gzip&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Create archive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tar -cvf archive.tar folder/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tar -xvf archive.tar
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gzip file.txt
gunzip file.txt.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;🔚 Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Linux file system is a powerful and flexible system, and the commands above will help you navigate and control it like a pro. If you're pursuing DevOps, mastering these tools is essential.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>filesystem</category>
      <category>terminal</category>
      <category>bash</category>
    </item>
    <item>
      <title>Understanding Ansible Configuration Priority</title>
      <dc:creator>DevOps Man</dc:creator>
      <pubDate>Thu, 03 Apr 2025 15:15:13 +0000</pubDate>
      <link>https://dev.to/vishnutejas/understanding-ansible-configuration-priority-1mej</link>
      <guid>https://dev.to/vishnutejas/understanding-ansible-configuration-priority-1mej</guid>
      <description>&lt;p&gt;When working with Ansible, it's crucial to understand how configuration settings are applied and in what order. Ansible allows multiple ways to configure its behavior, and these settings follow a specific priority order. This ensures flexibility while also allowing users to override defaults as needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuration Sources and Their Priority Order
&lt;/h2&gt;

&lt;p&gt;Ansible configurations can be defined in various locations. The following list shows the priority order from lowest to highest, meaning settings at a higher level override those at a lower level:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Default Settings (Lowest Priority)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ansible has built-in defaults that apply if no other configuration is specified.&lt;/li&gt;
&lt;li&gt;These are hardcoded within Ansible and serve as fallback values.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;System-Wide Configuration (/etc/ansible/ansible.cfg)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This configuration file is used for system-wide Ansible settings.&lt;/li&gt;
&lt;li&gt;Any user on the system running Ansible will inherit these settings unless overridden.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;User-Specific Configuration (~/.ansible.cfg)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This file allows a user to define their own Ansible settings.&lt;/li&gt;
&lt;li&gt;It overrides the system-wide configuration but can still be overridden by more specific settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Project-Specific Configuration (ansible.cfg in the Current Directory)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If an ansible.cfg file exists in the working directory where the Ansible command is executed, it takes precedence over both system-wide and user-specific configurations.&lt;/li&gt;
&lt;li&gt;This is useful for project-specific configurations where different settings may be required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Environment Variables&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ansible allows configuration via environment variables, such as ANSIBLE_CONFIG.&lt;/li&gt;
&lt;li&gt;If set, these variables override any file-based configurations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Command-Line Options (Highest Priority)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The highest priority is given to command-line options specified when running Ansible.&lt;/li&gt;
&lt;li&gt;For example, using ansible-playbook -i custom_inventory site.yml overrides inventory settings from configuration files.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Best Practices:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use project-specific ansible.cfg to maintain consistency within a project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid modifying system-wide configuration unless necessary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use environment variables for temporary changes without modifying configuration files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Always check the effective configuration using:&lt;br&gt;
&lt;code&gt;ansible-config dump --only-changed&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Understanding Ansible’s configuration priority ensures that you apply settings in the most effective way. By following this hierarchy, you can control and override configurations efficiently, improving your automation workflows.&lt;/p&gt;

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