<?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: Dharamraj Yadav</title>
    <description>The latest articles on DEV Community by Dharamraj Yadav (@dharam_in).</description>
    <link>https://dev.to/dharam_in</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3783401%2Fce99eeb0-0e47-4ecb-8645-a966077c4605.png</url>
      <title>DEV Community: Dharamraj Yadav</title>
      <link>https://dev.to/dharam_in</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dharam_in"/>
    <language>en</language>
    <item>
      <title>Mastering systemd, SSH, and Package Management</title>
      <dc:creator>Dharamraj Yadav</dc:creator>
      <pubDate>Sun, 19 Jul 2026 11:39:17 +0000</pubDate>
      <link>https://dev.to/dharam_in/mastering-systemd-ssh-and-package-management-13d5</link>
      <guid>https://dev.to/dharam_in/mastering-systemd-ssh-and-package-management-13d5</guid>
      <description>&lt;h1&gt;
  
  
  Week 5 of My DevSecOps Journey — systemd, SSH &amp;amp; Package Management
&lt;/h1&gt;

&lt;p&gt;This week was all about how a Linux server &lt;em&gt;actually&lt;/em&gt; works behind the scenes. Three big things: how Linux runs services in the background (systemd), how you securely log into remote servers (SSH), and how you manage software on a server (package management). I also did real hands-on stuff on my own EC2 — building a service, setting up tunnels, and hardening SSH. Here's everything in my own words.&lt;/p&gt;




&lt;h2&gt;
  
  
  systemd: The Boss Process (PID 1) — what it is and why it exists
&lt;/h2&gt;

&lt;p&gt;systemd is the first process that starts when linux boots, and it runs as PID 1. It's the parent of every other process in the system. systemd supervises them while the machine is on and restarts them if they crash. Because it's designed never to fail, if it died the whole system would go down with it.&lt;/p&gt;

&lt;p&gt;That's the "why it exists" part — when a computer boots, &lt;em&gt;something&lt;/em&gt; has to bring the whole system up (networking, logging, ssh) and keep it alive with no human sitting there. systemd is that something.&lt;/p&gt;

&lt;p&gt;You can see it yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps &lt;span class="nt"&gt;-p&lt;/span&gt; 1        &lt;span class="c"&gt;# this shows PID 1, and it will say systemd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Units and Their Four Types
&lt;/h2&gt;

&lt;p&gt;A unit is one thing that systemd manages — "unit" is the general word, and there are several types. The four common ones:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;.service&lt;/strong&gt; = a running program / background job (e.g. a web server). This is where you declare what to run and how. The main type you'll use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;.target&lt;/strong&gt; = a checkpoint that groups other units together. It runs nothing itself, it just means "this whole group of services should be on by now" (like &lt;code&gt;multi-user.target&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;.timer&lt;/strong&gt; = a scheduler that starts another unit at a set time or interval. A modern replacement for cron.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;.socket&lt;/strong&gt; = a doorway that starts a service on demand, only when a connection actually arrives, instead of keeping it running all the time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The way I think about it: a &lt;strong&gt;service&lt;/strong&gt; is a &lt;em&gt;doer&lt;/em&gt; (a program doing a job), and a &lt;strong&gt;target&lt;/strong&gt; is a &lt;em&gt;checkpoint&lt;/em&gt; (a milestone that just says a group of stuff is up).&lt;/p&gt;

&lt;p&gt;You can list them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;systemctl list-units &lt;span class="nt"&gt;--type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;service
systemctl list-units &lt;span class="nt"&gt;--type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;target
systemctl status &amp;lt;name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Old Init Systems vs systemd
&lt;/h2&gt;

&lt;p&gt;The old init system — called SysV init — had several problems. It started services one at a time, sequentially, by running startup scripts, which made booting slow. It also didn't have any auto-restart mechanism — once a script ran, init forgot about it, so if the service crashed nobody noticed. And it could only control the &lt;em&gt;order&lt;/em&gt; things started, not real dependencies.&lt;/p&gt;

&lt;p&gt;New systemd fixed all of this. It runs services in parallel (much faster), it supervises them and restarts them if they crash, and it understands real dependencies. That's why the world moved from old systems to systemd.&lt;/p&gt;




&lt;h2&gt;
  
  
  Writing Your First Custom Service File
&lt;/h2&gt;

&lt;p&gt;To register your own program with systemd, you write a small &lt;code&gt;.service&lt;/code&gt; file. It's basically a form with three sections:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;[Unit]&lt;/strong&gt; = what it is&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[Service]&lt;/strong&gt; = how to run it&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;[Install]&lt;/strong&gt; = when it starts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I created one for my own monitor script (it checks CPU, memory and disk usage). The file goes in &lt;code&gt;/etc/systemd/system/&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;vim /etc/systemd/system/monitor.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[Unit]&lt;/span&gt;
&lt;span class="py"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;System monitor script (CPU, memory, disk)&lt;/span&gt;

&lt;span class="nn"&gt;[Service]&lt;/span&gt;
&lt;span class="py"&gt;Type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;oneshot&lt;/span&gt;
&lt;span class="py"&gt;ExecStart&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/home/aadi/system-monitoring/monitor.sh&lt;/span&gt;

&lt;span class="nn"&gt;[Install]&lt;/span&gt;
&lt;span class="py"&gt;WantedBy&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;multi-user.target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One important thing here is &lt;code&gt;Type=oneshot&lt;/code&gt;. My script runs once, does its job, and exits — it's not a forever-running program like a web server. &lt;code&gt;oneshot&lt;/code&gt; tells systemd "this one runs once and finishes, that's normal, don't think it crashed."&lt;/p&gt;

&lt;p&gt;After creating or editing the file, you have to tell systemd to re-read it (it doesn't notice new files automatically):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl daemon-reload        &lt;span class="c"&gt;# always run this after editing a unit file&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start monitor        &lt;span class="c"&gt;# run it now&lt;/span&gt;
systemctl status monitor            &lt;span class="c"&gt;# check it&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable &lt;/span&gt;monitor       &lt;span class="c"&gt;# make it start at boot&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: &lt;code&gt;start&lt;/code&gt; and &lt;code&gt;enable&lt;/code&gt; are two different things. &lt;code&gt;start&lt;/code&gt; runs it right now. &lt;code&gt;enable&lt;/code&gt; makes it start automatically at boot. When you &lt;code&gt;enable&lt;/code&gt; a service, systemd just creates a symlink inside &lt;code&gt;multi-user.target.wants/&lt;/code&gt; — that folder is the target's "guest list," and at boot the target starts everything in it.&lt;/p&gt;

&lt;p&gt;Also — use full paths in your script. systemd doesn't run inside your folder, so a relative path like &lt;code&gt;./logs&lt;/code&gt; will break. Always use the absolute path.&lt;/p&gt;




&lt;h2&gt;
  
  
  Dependencies — After, Requires, Wants
&lt;/h2&gt;

&lt;p&gt;This is the part that confuses people, so I want to get it right. In a service file, &lt;strong&gt;order&lt;/strong&gt; and &lt;strong&gt;requirement&lt;/strong&gt; are two completely separate things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;After=X&lt;/strong&gt; → start this &lt;em&gt;after&lt;/em&gt; X. This is only about order, it doesn't mean you need X.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wants=X&lt;/strong&gt; → weak dependency: pull X in too, but start even if X fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Requires=X&lt;/strong&gt; → strong dependency: if X fails or stops, stop this too.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trap: &lt;code&gt;Requires=&lt;/code&gt; says nothing about order. So &lt;code&gt;Requires=postgresql.service&lt;/code&gt; on its own will start your app and the database &lt;em&gt;at the same time&lt;/em&gt; — and your app might try to connect before the DB is ready. That's why you usually pair them:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="py"&gt;Requires&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;postgresql.service&lt;/span&gt;
&lt;span class="py"&gt;After&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;postgresql.service&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Requirement says &lt;em&gt;whether&lt;/em&gt;, ordering says &lt;em&gt;when&lt;/em&gt;. You normally need both.&lt;/p&gt;




&lt;h2&gt;
  
  
  Reading Logs with journalctl
&lt;/h2&gt;

&lt;p&gt;Every service that systemd runs writes its logs to one central place, and &lt;code&gt;journalctl&lt;/code&gt; is the tool to read them. Think of it like the machine's diary.&lt;/p&gt;

&lt;p&gt;The whole skill is filtering — you never read everything. The most useful command is &lt;code&gt;-u&lt;/code&gt;, which shows only one service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; monitor.service      &lt;span class="c"&gt;# only this service's logs&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; ssh &lt;span class="nt"&gt;-f&lt;/span&gt;               &lt;span class="c"&gt;# follow live (Ctrl+C to exit)&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; ssh &lt;span class="nt"&gt;--since&lt;/span&gt; today    &lt;span class="c"&gt;# only today's logs&lt;/span&gt;
journalctl &lt;span class="nt"&gt;-n&lt;/span&gt; 20                   &lt;span class="c"&gt;# last 20 lines&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without &lt;code&gt;-u&lt;/code&gt;, you get every program mixed together and it's unreadable. So &lt;code&gt;-u &amp;lt;service&amp;gt;&lt;/code&gt; is what actually makes journalctl useful.&lt;/p&gt;




&lt;h2&gt;
  
  
  Timers — the Modern Cron
&lt;/h2&gt;

&lt;p&gt;A timer is like an alarm clock that starts a service on a schedule. It comes as a &lt;strong&gt;pair&lt;/strong&gt;: a &lt;code&gt;.timer&lt;/code&gt; file (the &lt;em&gt;when&lt;/em&gt;) and a &lt;code&gt;.service&lt;/code&gt; file (the &lt;em&gt;work&lt;/em&gt;). And if they have the same name — &lt;code&gt;monitor.timer&lt;/code&gt; and &lt;code&gt;monitor.service&lt;/code&gt; — systemd links them automatically.&lt;/p&gt;

&lt;p&gt;I made a timer to run my monitor script every 2 minutes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="nn"&gt;[Unit]&lt;/span&gt;
&lt;span class="py"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Run system monitor every 2 minutes&lt;/span&gt;

&lt;span class="nn"&gt;[Timer]&lt;/span&gt;
&lt;span class="py"&gt;OnBootSec&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;2min&lt;/span&gt;
&lt;span class="py"&gt;OnUnitActiveSec&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;2min&lt;/span&gt;

&lt;span class="nn"&gt;[Install]&lt;/span&gt;
&lt;span class="py"&gt;WantedBy&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;timers.target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;OnBootSec&lt;/code&gt; = first run after boot. &lt;code&gt;OnUnitActiveSec&lt;/code&gt; = repeat interval. For calendar-based scheduling (like "every night at 2am") you'd use &lt;code&gt;OnCalendar&lt;/code&gt; instead.&lt;/p&gt;

&lt;p&gt;One important thing: you start the &lt;strong&gt;timer&lt;/strong&gt;, not the service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl daemon-reload
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl start monitor.timer
systemctl list-timers               &lt;span class="c"&gt;# shows next fire time + which service it triggers&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The cool part was opening &lt;code&gt;journalctl -u monitor.service -f&lt;/code&gt; and watching my script fire on its own every 2 minutes, with nobody touching anything. That's when it clicked — my machine was monitoring itself automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  SSH — Key-Based Authentication
&lt;/h2&gt;

&lt;p&gt;SSH (Secure Shell) lets you get a terminal on another machine over the network. Instead of logging in with a password (which bots can guess and which travels over the network), you use a &lt;strong&gt;key pair&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The way I understand it — think of a padlock and its key:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Public key&lt;/strong&gt; (&lt;code&gt;.pub&lt;/code&gt;) = the padlock. You can share it freely, and it goes &lt;strong&gt;on the server&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private key&lt;/strong&gt; = the secret key. It stays &lt;strong&gt;on your laptop&lt;/strong&gt; and you never share it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The server locks a challenge with your padlock, and only your private key can open it — and it does that on your own machine. So the secret never travels over the network. That's the whole win over passwords.&lt;/p&gt;

&lt;p&gt;Generate a key:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh-keygen &lt;span class="nt"&gt;-t&lt;/span&gt; ed25519 &lt;span class="nt"&gt;-C&lt;/span&gt; &lt;span class="s2"&gt;"my laptop key"&lt;/span&gt;
ssh-copy-id user@host        &lt;span class="c"&gt;# copies your public key onto the server&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Fun fact: on AWS EC2, the &lt;code&gt;.pem&lt;/code&gt; file AWS gives you &lt;em&gt;is&lt;/em&gt; a private key. AWS already put the public half on the instance. So &lt;code&gt;ssh -i key.pem ubuntu@IP&lt;/code&gt; is already key-based auth — I was doing it without realizing it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The SSH Config File
&lt;/h2&gt;

&lt;p&gt;Typing the full command every time is painful:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-i&lt;/span&gt; ~/Downloads/testawsmachine.pem ubuntu@16.170.254.209
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So you save all of that under a nickname in &lt;code&gt;~/.ssh/config&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ssh"&gt;&lt;code&gt;&lt;span class="k"&gt;Host&lt;/span&gt; testaws
    &lt;span class="k"&gt;HostName&lt;/span&gt; &lt;span class="m"&gt;16&lt;/span&gt;.170.254.209
    &lt;span class="k"&gt;User&lt;/span&gt; ubuntu
    &lt;span class="k"&gt;IdentityFile&lt;/span&gt; ~/Downloads/testawsmachine.pem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now I just type:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh testaws
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's not magic — SSH reads the config, expands the nickname back into the full command, and logs in with the key. &lt;code&gt;Host&lt;/code&gt; is the nickname you type, &lt;code&gt;HostName&lt;/code&gt; is the real address, &lt;code&gt;User&lt;/code&gt; is the username, &lt;code&gt;IdentityFile&lt;/code&gt; is the key.&lt;/p&gt;




&lt;h2&gt;
  
  
  SSH Tunneling — -L, -D, -R
&lt;/h2&gt;

&lt;p&gt;This one bends your brain a bit. The core idea: one SSH connection can do &lt;strong&gt;two jobs at once&lt;/strong&gt; — carry your terminal &lt;em&gt;and&lt;/em&gt; carry other network traffic through the same encrypted connection.&lt;/p&gt;

&lt;p&gt;The trick to remembering the flags: &lt;strong&gt;local = your laptop, remote = the server.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;-L (local forwarding)&lt;/strong&gt; → your laptop reaches &lt;em&gt;into&lt;/em&gt; the server. Good for reaching a service on the server that isn't open to the internet (like a database).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-L&lt;/span&gt; 8080:127.0.0.1:8080 testaws
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran a tiny web server on my EC2 bound to &lt;code&gt;127.0.0.1&lt;/code&gt; (so only the EC2 could see it), and using &lt;code&gt;-L&lt;/code&gt; I opened it in my laptop's browser — reaching a "locked inside" service through SSH.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;-D (dynamic forwarding = SOCKS proxy)&lt;/strong&gt; → route &lt;em&gt;anything&lt;/em&gt; through the server, so the world sees the server's IP instead of yours.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-D&lt;/span&gt; 1080 testaws
curl &lt;span class="nt"&gt;--socks5&lt;/span&gt; 127.0.0.1:1080 https://api.ipify.org
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I ran that curl, it showed my EC2's IP, not my home IP — proof my traffic was going out through the server in Europe. This is how you'd route your browser through your own server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;-R (remote forwarding)&lt;/strong&gt; → the mirror of &lt;code&gt;-L&lt;/code&gt;. The server reaches &lt;em&gt;back into&lt;/em&gt; your laptop. Good for exposing something running on your laptop through the server's public address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-R&lt;/span&gt; 9090:127.0.0.1:9090 testaws
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I ran a server on my &lt;em&gt;laptop&lt;/em&gt; and fetched it &lt;em&gt;from inside the EC2&lt;/em&gt; — a server in a data center reading files off my laptop, through the tunnel. Mind-bending but cool.&lt;/p&gt;

&lt;p&gt;Quick summary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;-L&lt;/strong&gt; → laptop into server (one fixed target)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;-D&lt;/strong&gt; → laptop to anywhere through the server (proxy)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;-R&lt;/strong&gt; → server back into laptop&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's also &lt;strong&gt;ssh-agent&lt;/strong&gt; (holds your unlocked key in memory so you type the passphrase once) and the &lt;strong&gt;-A&lt;/strong&gt; flag (agent forwarding, to carry your key identity to another server) — but only use &lt;code&gt;-A&lt;/code&gt; with servers you trust.&lt;/p&gt;




&lt;h2&gt;
  
  
  Package Management — apt &amp;amp; dnf/yum
&lt;/h2&gt;

&lt;p&gt;A server has no app store with buttons, so you install software by command. On Ubuntu that command is &lt;strong&gt;apt&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The thing that confused me at first is that it's a two-step process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;apt update&lt;/strong&gt; = refresh the list of available software. This installs nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;apt upgrade&lt;/strong&gt; = actually update the software you already have.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;apt install X&lt;/strong&gt; = install a new program.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update              &lt;span class="c"&gt;# do this FIRST&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt upgrade             &lt;span class="c"&gt;# update everything&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;tree        &lt;span class="c"&gt;# install a package&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt remove tree         &lt;span class="c"&gt;# uninstall&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you skip &lt;code&gt;apt update&lt;/code&gt;, apt might say "Unable to locate package" even for real software — because its list is stale. So always update first. (This actually happened to me.)&lt;/p&gt;

&lt;p&gt;Other distros use different tools for the same job. Red Hat family (Amazon Linux, CentOS, Fedora) use &lt;strong&gt;yum&lt;/strong&gt; or &lt;strong&gt;dnf&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;apt update&lt;/code&gt; → &lt;code&gt;dnf check-update&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;apt install X&lt;/code&gt; → &lt;code&gt;dnf install X&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;apt upgrade&lt;/code&gt; → &lt;code&gt;dnf upgrade&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One gotcha: in dnf/yum, &lt;code&gt;update&lt;/code&gt; means "install upgrades" — the opposite of apt's &lt;code&gt;update&lt;/code&gt;. And &lt;code&gt;dnf&lt;/code&gt; is just the newer version of &lt;code&gt;yum&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  SSH Hardening
&lt;/h2&gt;

&lt;p&gt;This is where DevSecOps really starts — locking down the SSH server so attackers can't get in. The settings live in a file called &lt;code&gt;sshd_config&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;⚠️ &lt;strong&gt;The golden rule (learned this the important way):&lt;/strong&gt; never lock yourself out. Always keep your working session open, test the config &lt;em&gt;before&lt;/em&gt; restarting, and test a new login in a second terminal — and only close the original session once the new login works.&lt;/p&gt;

&lt;p&gt;The two main changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;PasswordAuthentication no&lt;/strong&gt; → only key logins allowed. This kills password-guessing bots completely.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PermitRootLogin no&lt;/strong&gt; → block direct login as root. "root" is the one username every attacker tries, so blocking it removes the obvious target.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The clean way I did it was to create my own config file (so I don't mess with what AWS set up). Files in &lt;code&gt;/etc/ssh/sshd_config.d/&lt;/code&gt; are read in order and the first setting wins, so a lower number wins:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;vim /etc/ssh/sshd_config.d/10-hardening.conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;&lt;span class="err"&gt;PermitRootLogin&lt;/span&gt; &lt;span class="err"&gt;no&lt;/span&gt;
&lt;span class="err"&gt;PasswordAuthentication&lt;/span&gt; &lt;span class="err"&gt;no&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then the safe workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;sshd &lt;span class="nt"&gt;-t&lt;/span&gt;                      &lt;span class="c"&gt;# test config (silent output = OK)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl restart ssh
&lt;span class="c"&gt;# in a SECOND terminal, confirm you can still log in:&lt;/span&gt;
ssh testaws                       &lt;span class="c"&gt;# should work&lt;/span&gt;
ssh root@testaws                  &lt;span class="c"&gt;# should be DENIED — proof it worked&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I tried &lt;code&gt;ssh root@testaws&lt;/code&gt; and got "Permission denied," that was the proof my hardening actually worked.&lt;/p&gt;

&lt;p&gt;One real lesson: always check the current settings &lt;em&gt;before&lt;/em&gt; changing them. On my EC2, AWS had already turned off password login by default — so I would've been "fixing" something that was already done. Check first, don't assume.&lt;/p&gt;




&lt;h2&gt;
  
  
  fail2ban — the Automatic Bouncer
&lt;/h2&gt;

&lt;p&gt;Even with hardening, bots constantly hammer a public server trying to log in. fail2ban is an automatic bouncer for exactly this: it watches the login logs, and if one IP fails to log in too many times too fast, it automatically bans that IP at the firewall.&lt;/p&gt;

&lt;p&gt;Its decision comes down to a few settings:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;maxretry&lt;/strong&gt; = how many failures before a ban&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;findtime&lt;/strong&gt; = the time window those failures must happen in&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;bantime&lt;/strong&gt; = how long the ban lasts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ignoreip&lt;/strong&gt; = IPs that are never banned (put your own home IP here so you don't lock yourself out)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the rule is basically: &lt;em&gt;X failures within Y minutes → ban for Z minutes.&lt;/em&gt; A typical default is 5 failures in 10 minutes → ban.&lt;/p&gt;

&lt;p&gt;The clever bit is that it's really &lt;strong&gt;rate-limiting&lt;/strong&gt; — a human fumbling a login once in a while never trips it, but a bot firing thousands of attempts a second trips it instantly. Hardening makes attacks &lt;em&gt;fail&lt;/em&gt;; fail2ban makes attackers &lt;em&gt;go away&lt;/em&gt;. Two layers = defense in depth.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;fail2ban
&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;--now&lt;/span&gt; fail2ban
&lt;span class="nb"&gt;sudo &lt;/span&gt;fail2ban-client status sshd
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;That was Week 5. By the end of it I'd built a service that monitors my own machine, put it on a timer so it runs automatically, learned to read logs with journalctl, set up key-based SSH with config aliases, tunneled traffic three different ways, managed packages, and hardened my EC2 so root and password logins are blocked.&lt;/p&gt;

&lt;p&gt;The biggest lesson wasn't any single command — it was that all this abstract stuff finally made sense when I &lt;em&gt;did&lt;/em&gt; it with my own hands and watched it work on a real server. On to Week 6.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>devsecops</category>
      <category>networking</category>
    </item>
    <item>
      <title>My First Bash Scripts: From Zero to Production-Quality</title>
      <dc:creator>Dharamraj Yadav</dc:creator>
      <pubDate>Sat, 11 Jul 2026 16:15:43 +0000</pubDate>
      <link>https://dev.to/dharam_in/my-first-bash-scripts-from-zero-to-production-quality-4b80</link>
      <guid>https://dev.to/dharam_in/my-first-bash-scripts-from-zero-to-production-quality-4b80</guid>
      <description>&lt;h2&gt;
  
  
  What a &lt;strong&gt;bash script&lt;/strong&gt; is
&lt;/h2&gt;

&lt;p&gt;Bash script is a box of commands that used to run multiple commands at a time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Shebang (#!/bin/bash)
&lt;/h2&gt;

&lt;p&gt;This is the very first line of the script that determine the shell, and based on the it'll execute the commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making a script executable
&lt;/h2&gt;

&lt;p&gt;When you create a script file you didn't have execute permission on that script file so you need to make that executable.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Variables
&lt;/h2&gt;

&lt;p&gt;You can create variable like this&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Make sure in the whole line don't have space if you add space anywhere that is not variable, and you can use the variable using the &lt;strong&gt;$&lt;/strong&gt; sign.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And variable names are case-sensitive so if you use capital or small letter both are different variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Dharam"&lt;/span&gt;
&lt;span class="nv"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Aadi"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you want to use the variable with text you we have double quote or single quote&lt;/p&gt;

&lt;h3&gt;
  
  
  Double Quote
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Dharam"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello my name is &lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="c"&gt;## it print this **Hello my name is Dharam**&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;when you use double quote it mean the doller sign represent the variable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Single Quote
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Dharam"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'Hello my name is $name'&lt;/span&gt;
&lt;span class="c"&gt;## it print this "Hello my name is $name"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Single quote use as a literal.&lt;/p&gt;

&lt;h3&gt;
  
  
  Arithmetic
&lt;/h3&gt;

&lt;p&gt;When you want to do arithmetic operation you need to use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;$((&lt;/span&gt;  &lt;span class="k"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conditions
&lt;/h2&gt;

&lt;p&gt;Age determine script&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$age&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; 20 &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;then
     &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"You are an adult"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a very very simple conditions it only determine one condition. if you want to add multiple condition you need to use elif.&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$marks&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-ge&lt;/span&gt; 80 &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;then
     &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"You got a first division"&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$marks&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-ge&lt;/span&gt; 60 &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;then
     &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"You got a second division"&lt;/span&gt;
&lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$marks&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-ge&lt;/span&gt; 38 &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;then
     &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"You got a third division"&lt;/span&gt;
&lt;span class="k"&gt;else
     &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"You are fail!"&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Condition Number comparisons
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-ge, -gt, -le, -lt, -eq, -ne
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  case, esac and *) also use to for one value.
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Loops
&lt;/h2&gt;

&lt;h3&gt;
  
  
  For Loop
&lt;/h3&gt;



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

&lt;span class="k"&gt;for &lt;/span&gt;num &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;1..10&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;do
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$num&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;This will print 1 to 10. for loop used to a fixed range we know the range.&lt;/p&gt;

&lt;h3&gt;
  
  
  While Loop
&lt;/h3&gt;



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

&lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$count&lt;/span&gt; &lt;span class="nt"&gt;-lt&lt;/span&gt; 10 &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;do
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$count&lt;/span&gt;
    &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$((&lt;/span&gt; count &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="k"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While loop used to we don't know when the condition fullfill.&lt;/p&gt;

&lt;h3&gt;
  
  
  Until Loop
&lt;/h3&gt;



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

&lt;span class="k"&gt;until&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nv"&gt;$count&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; 10 &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;do
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$count&lt;/span&gt;
    &lt;span class="nv"&gt;count&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$((&lt;/span&gt; count &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="k"&gt;))&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The count loop is opposite of the while loop, it stops when the condition become true.&lt;/p&gt;

&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;



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

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

greet&lt;span class="o"&gt;(){&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello My name is &lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;The functions are used to do some certain tasks. and we can also pass the arguments to the functions:-&lt;br&gt;
&lt;/p&gt;

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

greet&lt;span class="o"&gt;(){&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello My name is &lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"I'm learning the &lt;/span&gt;&lt;span class="nv"&gt;$2&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

greet Dharam DevSecOps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The $1, $2 are the arguments value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error Handling (Production-Quality)
&lt;/h2&gt;

&lt;p&gt;Remember we have two type of code one is &lt;strong&gt;0&lt;/strong&gt; and second is except &lt;strong&gt;0&lt;/strong&gt;, &lt;strong&gt;0&lt;/strong&gt; mean command run succeed properly if the exit code is not 0 it mean command failed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Exit Code
&lt;/h3&gt;

&lt;p&gt;if you want to see your last command exit code you can use the &lt;strong&gt;$?&lt;/strong&gt; this'll shows the last command exit code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &amp;amp;&amp;amp; And ||
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &amp;amp;&amp;amp;
&lt;/h3&gt;

&lt;p&gt;This used to if the first command is run with exit code 0 then run second one otherwise not.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /folder/not/exists &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if we didn't use the &lt;strong&gt;&amp;amp;&amp;amp;&lt;/strong&gt; and the command before &amp;amp;&amp;amp; fails the second command also run, so we use the &amp;amp;&amp;amp; to prevent second command to run if first command is fail.&lt;/p&gt;

&lt;h3&gt;
  
  
  ||
&lt;/h3&gt;

&lt;p&gt;This used to if the command is failed then run the second one.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /myfol &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Do not entered in the folder"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  set -e
&lt;/h3&gt;

&lt;p&gt;This is very important to use in bash script.&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"First Command"&lt;/span&gt;

&lt;span class="nb"&gt;cd&lt;/span&gt; /folder/not/exists

&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;set -e&lt;/strong&gt; stop the script if the any command failed. this is lifesaver.&lt;/p&gt;

&lt;h3&gt;
  
  
  set -u
&lt;/h3&gt;

&lt;p&gt;Stop the script if the variable is undefined. use it like set -e.&lt;/p&gt;

&lt;h3&gt;
  
  
  set -o pipefail
&lt;/h3&gt;

&lt;p&gt;set -o pipefail makes the whole pipe count as failed if any command in it fails (not just the last). So the failure shows up in the exit code instead of being hidden.&lt;/p&gt;

&lt;h3&gt;
  
  
  set -euo pipefail
&lt;/h3&gt;

&lt;p&gt;You can use the all options together.&lt;/p&gt;

&lt;h2&gt;
  
  
  trap
&lt;/h2&gt;

&lt;p&gt;This mean run the command if the script fail or succeed, it is very helpful when we want to clear something if you script fail or succeed. and also if you press ctrl c then also it run.&lt;/p&gt;

</description>
      <category>automation</category>
      <category>devops</category>
      <category>linux</category>
      <category>bash</category>
    </item>
    <item>
      <title>Understanding File Descriptors &amp; Redirection in Linux</title>
      <dc:creator>Dharamraj Yadav</dc:creator>
      <pubDate>Mon, 06 Jul 2026 18:35:04 +0000</pubDate>
      <link>https://dev.to/dharam_in/understanding-file-descriptors-redirection-in-linux-ca2</link>
      <guid>https://dev.to/dharam_in/understanding-file-descriptors-redirection-in-linux-ca2</guid>
      <description>&lt;h2&gt;
  
  
  File Descriptors
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is a File Descriptors
&lt;/h3&gt;

&lt;p&gt;A file descriptor is simply a non-negative integer that the opreting system uses to identify an open file or I/O resources. in linux eveything is treating as a file, including a regular file, pipes, sockets, and devices. Every process starts with three standard file descriptor.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;0 – stdin (standard input)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;1 – stdout (standard output)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;2 – stderr (standard error)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Redirection in Linux
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &amp;gt;
&lt;/h3&gt;

&lt;p&gt;single greater-than (&amp;gt;) redirection in linux used to overwrite the file. for example:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Hello"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &amp;gt;&amp;gt;
&lt;/h3&gt;

&lt;p&gt;double greater-than (&amp;gt;&amp;gt;) used to append in the file. for example:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"My Name is Dharam"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &amp;lt;
&lt;/h3&gt;

&lt;p&gt;less-than use to input from a file. for example:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt; &amp;lt; file.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2&amp;gt;
&lt;/h3&gt;

&lt;p&gt;redirect error to a file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-la&lt;/span&gt; not-exist-file.txt 2&amp;gt; error.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2&amp;gt;&amp;amp;1
&lt;/h3&gt;

&lt;p&gt;redirect error and without error output&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; file.txt test.txt &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; output.txt 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &amp;amp;&amp;gt; and &amp;amp;&amp;gt;&amp;gt;
&lt;/h2&gt;

&lt;p&gt;sort version of 2&amp;gt;&amp;amp;1, this redirection also use to output and error.&lt;/p&gt;

&lt;h3&gt;
  
  
  tee
&lt;/h3&gt;

&lt;p&gt;tee command used to view and redirect output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; testfile.txt | &lt;span class="nb"&gt;tee &lt;/span&gt;output.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  | - Pipe
&lt;/h2&gt;

&lt;p&gt;Pipe (|): Sends the output of one command directly as the input to another command.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>linux</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>How Linux Actually Runs Your Programs: Processes, Signals &amp; systemd in Plain English</title>
      <dc:creator>Dharamraj Yadav</dc:creator>
      <pubDate>Sat, 27 Jun 2026 16:32:16 +0000</pubDate>
      <link>https://dev.to/dharam_in/how-linux-actually-runs-your-programs-processes-signals-systemd-in-plain-english-3i90</link>
      <guid>https://dev.to/dharam_in/how-linux-actually-runs-your-programs-processes-signals-systemd-in-plain-english-3i90</guid>
      <description>&lt;h2&gt;
  
  
  Signals
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is signlas
&lt;/h3&gt;

&lt;p&gt;Signals are mechanism to communicate between kernel and processes, and between processes. For example if we want to STOP the process we send SIGSTOP(kill STOP ) Signal and kernel deliver that signal to process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Examples Of Signals
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;SIGTERM - Terminate the process&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SIGSTOP - Stop The process&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SIGKILL - Forcefully Kill a process&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SIGINT - Interup the process&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The &lt;em&gt;kill&lt;/em&gt; command
&lt;/h3&gt;

&lt;p&gt;kill command use for process to kill,terminate,stop etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  Job Control &amp;amp; background processes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Foreground and Background
&lt;/h3&gt;

&lt;p&gt;Foreground mean a process running on the screen right now and blocks the terminal and this is default behavior of the commands and background mean a process running in the background that not block the terminal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;command&lt;/span&gt; &amp;amp;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for run process in background.&lt;/p&gt;

&lt;h3&gt;
  
  
  The &amp;amp; Operator
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;&amp;amp;&lt;/em&gt; operator is used to run a process in the background. For Example:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sleep &lt;/span&gt;300 &amp;amp;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  jobs, fg, bg commands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;jobs - Displays the jobs running or stopped in the current shell.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;fg - Brings a background and stopped job in the foreground.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;bg - Resumes a stopped job in the background.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  nohup command
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;nohub&lt;/em&gt; stand for &lt;strong&gt;No Hang Up&lt;/strong&gt;. it allows a process to continue running even your terminal is closed or your SSH session disconnects.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;nohup sleep &lt;/span&gt;300
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The process will keep running even if you close the terminal or disconnect your SSH session.&lt;/p&gt;

&lt;h2&gt;
  
  
  Viewing &amp;amp; monitoring processes
&lt;/h2&gt;



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

&lt;/div&gt;



&lt;p&gt;Displays a snapshot of the processes running in the current terminal(current shell session).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps aux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Displays a snapshot of the all running processes with details such as user,pid,CPU usage,memory usage,process state,time,command etc.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Displays a live, real time running processes with CPU and memory usage.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Displays a live running processes in a interactive view. it is more user friendly version of top.&lt;/p&gt;

&lt;h3&gt;
  
  
  The State column in processes
&lt;/h3&gt;

&lt;p&gt;Every process has a state that indicate its current status. The kernel maintain this state, and commands like ps and top display it to user:-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;S - Sleeping&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;R - Running/Runnable&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;D - Uninterruptible Sleep (usually waiting for I/O)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I - Idle&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Z - Zombie&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;T - Stops&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and process state have some flags like:-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;ul&gt;
&lt;li&gt;- Running in the foreground&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&amp;lt; - High Priority&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;l - Multi Threaded&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;s - Session leader&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;N - Low Priority&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;L - Pages locked in memory&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Finding the top CPU processes
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps aux &lt;span class="nt"&gt;--sort&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;-%cpu
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and if you want to see top memory consumer&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps aux &lt;span class="nt"&gt;--sort&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;-%mem
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  CPU vs Memory
&lt;/h2&gt;

&lt;h3&gt;
  
  
  CPU vs RAM
&lt;/h3&gt;

&lt;p&gt;The CPU is the brain of the computer, The CPU executes instructions and performs calculations. &lt;br&gt;
RAM is the computer's main memory, it stores the data and instructions that program are currently using.&lt;/p&gt;

&lt;h3&gt;
  
  
  Slow vs Crash
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;A System Slow&lt;/strong&gt;  indicates that one or more resources(CPU, RAM, Disk, Network) are heavily utilized, causing program to response slowly.&lt;br&gt;
&lt;strong&gt;A System Crash&lt;/strong&gt; occurs when the operating system and a application stops functioning correctly. one possible cause of out of memory.&lt;/p&gt;

&lt;h3&gt;
  
  
  The OOM Killar
&lt;/h3&gt;

&lt;p&gt;The OOM is a linux kernel mechanism that is triggered when the system is out of memory. instead of allowing the system to become completely unresponsive, the kernel select a high usage CPU and kill that.&lt;/p&gt;

&lt;h2&gt;
  
  
  How many processes runs at a time?
&lt;/h2&gt;

&lt;p&gt;Thousands of the process can exists in the system, but number of the process that can execute &lt;strong&gt;simultaneously&lt;/strong&gt; depends on the number of &lt;strong&gt;logical CPU cores&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Programs, Processes &amp;amp; Memory
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Programs
&lt;/h3&gt;

&lt;p&gt;Program is a set of of the instructions that store on disk.&lt;/p&gt;

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

&lt;p&gt;Process is a running instance of the program.&lt;/p&gt;

&lt;h3&gt;
  
  
  Memory
&lt;/h3&gt;

&lt;p&gt;Memory stores data and instructions that the CPU needs while executing a process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Swap
&lt;/h2&gt;

&lt;p&gt;Swap is a portion of disk space that linux uses as virtual memory when RAM becomes full.&lt;/p&gt;

&lt;h2&gt;
  
  
  Systemd
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is systemd
&lt;/h3&gt;

&lt;p&gt;systemd is the first process that runs after the system boot. it ensure that all other essential processes and services are started. and it's PID is 1.&lt;/p&gt;

&lt;h2&gt;
  
  
  Process scheduling
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Priority &amp;amp; the scheduler
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Priority:- Every Process has priority for decide who run next. and that priority decide from &lt;em&gt;nice&lt;/em&gt; if nice value is -20 it mean this is top priority and if process nice is 19 it mean it has low priority.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scheduler:- A CPU Core only execute a process (or thread) at a time. the scheduler is just manage the who runs next and how much CPU time each process gets.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  nice Value
&lt;/h3&gt;

&lt;p&gt;The nice value determines the scheduling priority of a normal process. Every normal process has a nice value ranging from &lt;strong&gt;-20 to 19&lt;/strong&gt;. A nice value of &lt;strong&gt;-20&lt;/strong&gt; gives the process highest priority, while &lt;strong&gt;19&lt;/strong&gt; gives it the lowest priority.&lt;/p&gt;

&lt;h3&gt;
  
  
  nice and renice command
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;nice:- Sets the nice value (priority) of a process when starting the process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;renice:- Changes the nice value (priority) of a running process.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  taskset command
&lt;/h2&gt;

&lt;p&gt;The taskset command used to set or view the CPU affinity of a process. It allows you to specify which CPU core or cores a process is allowed to run on.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>beginners</category>
      <category>devsecops</category>
    </item>
    <item>
      <title>I Thought I Knew Linux — Then I Actually Learned It (Week 1)</title>
      <dc:creator>Dharamraj Yadav</dc:creator>
      <pubDate>Sun, 21 Jun 2026 05:10:22 +0000</pubDate>
      <link>https://dev.to/dharam_in/i-thought-i-knew-linux-then-i-actually-learned-it-week-1-2ep9</link>
      <guid>https://dev.to/dharam_in/i-thought-i-knew-linux-then-i-actually-learned-it-week-1-2ep9</guid>
      <description>&lt;h2&gt;
  
  
  The Big Picture
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Before you read this doc you must know english is my second language and this doc is have completely my own words not any AI, translator etc.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  What an OS really is
&lt;/h3&gt;

&lt;p&gt;An Operating System is software that manage every system resources and it also manage - Hardware, Kernel, and User space.&lt;/p&gt;

&lt;h3&gt;
  
  
  Kernel mode and User mode
&lt;/h3&gt;

&lt;p&gt;Kernel mode handle every hardware related work and this is only thing that manage hardware. User mode is just showing us to running programs like right now you are in User mode, you never touch any hardware related things.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Kernel's 4 Jobs
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Process Management - Kernel manage every running process.&lt;/li&gt;
&lt;li&gt;Memory Management - Kernel decides which process get how much memory.&lt;/li&gt;
&lt;li&gt;Device Drivers - This is important job of kernel to manage devices(hardware, virtual).&lt;/li&gt;
&lt;li&gt;System Calls - A system call is a how a program asks the kernel to do something fot it.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;Users are very important part of the OS bcz it create wall of processes and a single server can manage multiple users.&lt;/p&gt;

&lt;h3&gt;
  
  
  UID
&lt;/h3&gt;

&lt;p&gt;Every user gets a UID so the kernel identify the user.&lt;/p&gt;

&lt;h3&gt;
  
  
  root
&lt;/h3&gt;

&lt;p&gt;This is the BOSS of the system he can do anything in the system without any confirmation model and one more thing the root can do anything but it doesn't mean root have kernel mode this is steel in the user mode.&lt;/p&gt;

&lt;h3&gt;
  
  
  Groups
&lt;/h3&gt;

&lt;p&gt;Every user have a group and we can manage the permissions on the group so we easily add/remove users from group.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Shell &amp;amp; Basic Commands
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What the shell actually is
&lt;/h3&gt;

&lt;p&gt;The shell is a program where we run commands. shell is a interface between kernel and users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Commands Structure
&lt;/h3&gt;

&lt;p&gt;program + options + argument. ls -l /home&lt;br&gt;
ls - program&lt;br&gt;
-l - option&lt;br&gt;
/home - argument&lt;/p&gt;

&lt;h2&gt;
  
  
  Core Commands
&lt;/h2&gt;

&lt;p&gt;ls - list the data(files &amp;amp; Directories)&lt;br&gt;
cat - View the inside file&lt;br&gt;
echo - print something&lt;br&gt;
touch - create a file&lt;br&gt;
cp - copy anything&lt;br&gt;
mv - move anything&lt;br&gt;
rm - remove anything(you only remove files &amp;amp; directories that access you have)&lt;/p&gt;

&lt;h3&gt;
  
  
  Navigation
&lt;/h3&gt;

&lt;p&gt;pwd - present working directory &lt;br&gt;
cd - change directory&lt;br&gt;
mkdir - create directory&lt;br&gt;
rmdir - remove empty directory&lt;/p&gt;

&lt;h3&gt;
  
  
  Absolute &amp;amp; Relative Path
&lt;/h3&gt;

&lt;p&gt;Absolute path mean full path of the file for example:- /home/user/directory/test.txt&lt;/p&gt;

&lt;p&gt;Relative path mean only current folder path for example:- directory/test.txt&lt;/p&gt;

&lt;h3&gt;
  
  
  Wildcards(globbing)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;- ls *.txt(now * mean find only .txt files)
? - ls filen?ame.txt(it mean now the ? find only one single letter)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Intermediate Commands
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Searching/Viewing
&lt;/h3&gt;

&lt;p&gt;grep - this cmds grep the exact line what we want(grep "findme" file.txt). -i(case insensitive) and -v(this exclude lines that containing findme) is options of this cmd.&lt;br&gt;
sort - sort lines alphabetically.&lt;br&gt;
head - bydefault print 10 top lines(head filename.txt)&lt;br&gt;
tail - bydefault print 10 bottom lines(tail filename.txt)&lt;br&gt;
less - not print everything in single time it wait for your keys(up, down, q etc.)&lt;/p&gt;

&lt;h3&gt;
  
  
  Finding/inspecting
&lt;/h3&gt;

&lt;p&gt;find - this find in the subfolders also(but ls find only on the current directory)&lt;br&gt;
locate - quickly find files and direcotries&lt;br&gt;
diff - check differences between two files&lt;br&gt;
file - details of any file&lt;/p&gt;

&lt;h2&gt;
  
  
  Variables &amp;amp; PATH
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Shell Variables &amp;amp; Environment Variables
&lt;/h3&gt;

&lt;p&gt;Shell variable are the private variables of the shell we can't use them in child programs but environment variable can do but before it we need to export that.&lt;/p&gt;

&lt;h3&gt;
  
  
  How shell finds commands
&lt;/h3&gt;

&lt;p&gt;shell find cmds on the $PATH not in the whole system if sometime the program is installed but the shell throe error like (command not find) it mean that cmd is not in the $PATH&lt;/p&gt;

&lt;h2&gt;
  
  
  Editing, Help, Input/Output &amp;amp; Errors
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Editing in the terminal
&lt;/h3&gt;

&lt;p&gt;vi, vim, nano, these are the terminal editors.(vim filename.txt)&lt;br&gt;
Getting Help: man, man -k, --help. (-k mean search keyword)&lt;br&gt;
Redirection &amp;amp; Pipes: &amp;gt;(&amp;gt; mean overwrite the content), &amp;gt;&amp;gt;(&amp;gt;&amp;gt; mean append the text), | (| mean get output preview cmd)&lt;/p&gt;

&lt;h2&gt;
  
  
  Processes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is process
&lt;/h3&gt;

&lt;p&gt;Process is a running instance of the program and every process have a PID(we can kill the process by their PID)&lt;/p&gt;

&lt;h3&gt;
  
  
  Process Commands
&lt;/h3&gt;

&lt;p&gt;ps: Show running Processes&lt;br&gt;
ps aux: Show running processes with details&lt;br&gt;
kill : kill process by their PID&lt;br&gt;
kill -9 : forcefully kill the process&lt;br&gt;
cmd &amp;amp;: &amp;amp; used for run process in background&lt;br&gt;
ctrl c: stop running process from screen that running right now on screen&lt;/p&gt;

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

&lt;p&gt;When we run the ls -l command you see something like this:-&lt;br&gt;
-rwx-w-rw- 1 username groupname so on....&lt;br&gt;
Breakdown of this:-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;-&amp;gt; -(hyphen) mean this is a file
rwx - r stand for read, w stand for write, x stand for execute.
first 3 letter for owner, then 3 letter for group, and last three letter for others(other users).
in our output(-rwx-w-rw-) you see -(hyphen) it mean this is file. then you see rwx it mean owner have read,write,execute permission. then you see (-w-) it mean group have only write permission not read not execute. and last 3(rw-) it mean others have read and write permission not execute.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Change the permission
&lt;/h3&gt;

&lt;p&gt;chmod - it mean change mode so you can change the permissions like chmod 747. each permission have a number:-&lt;br&gt;
read - 4&lt;br&gt;
write - 2&lt;br&gt;
execute - 1&lt;br&gt;
if we want read(4) and write(2) permission to owner just run this command chmod 600. 00 mean no permission to group and other.&lt;br&gt;
and we use something like chmod u+x, u+r. it mean please add execute and read permission for user(owner).&lt;/p&gt;

&lt;h3&gt;
  
  
  Symbolic Links
&lt;/h3&gt;

&lt;p&gt;Symbolic link just like shortcut in window and alias in mac.&lt;br&gt;
Commands for linux:-&lt;br&gt;
ln -s target linkname&lt;br&gt;
the -s stand for symbolic link OR soft link.&lt;/p&gt;

&lt;h2&gt;
  
  
  Archiving
&lt;/h2&gt;

&lt;h3&gt;
  
  
  tar command
&lt;/h3&gt;

&lt;p&gt;tar mean bundle of the files &amp;amp; directories.&lt;br&gt;
if you want to create a bundle just run this cmd:- tar -czf filename.tar yourstuffs&lt;br&gt;
Options of the cmd:-&lt;br&gt;
-czf - mean create&lt;br&gt;
-tzf - mean show the list inside bundle&lt;br&gt;
-xzf - mean extract the bundle&lt;/p&gt;

&lt;h3&gt;
  
  
  gzip command
&lt;/h3&gt;

&lt;p&gt;gzip mean compress the file size of the bundle. it only used for create bundle + compress the size. &lt;br&gt;
.tar.gz&lt;/p&gt;

&lt;h2&gt;
  
  
  Filesystem in Linux
&lt;/h2&gt;

&lt;p&gt;In linux root you see this directories:-&lt;br&gt;
etc, home, var, usr, tmp etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  etc
&lt;/h3&gt;

&lt;p&gt;This directory have only configuration related data.&lt;/p&gt;

&lt;h3&gt;
  
  
  home
&lt;/h3&gt;

&lt;p&gt;This is only for users. how many users with there personal data.&lt;/p&gt;

&lt;h3&gt;
  
  
  var
&lt;/h3&gt;

&lt;p&gt;This directory for the logs of the system and logs are inside /var/log&lt;/p&gt;

&lt;h3&gt;
  
  
  usr
&lt;/h3&gt;

&lt;p&gt;This directory have most installed programs and /usr/bin have linux commands.&lt;/p&gt;

&lt;h3&gt;
  
  
  tmp
&lt;/h3&gt;

&lt;p&gt;This directory have temporary data as it name.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running Commands as super user(sudo)
&lt;/h2&gt;

&lt;p&gt;Every linux user should know about this topic. coz it is very important to know. in linux you can't delete,view,run anything without permission and every user have permissions to what to do or not. some users have sudo access it mean they can install, delete anything in system without any permission bcz they have root access sudo stand for super user.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>My First CI/CD Pipeline with YAML and Docker on AWS</title>
      <dc:creator>Dharamraj Yadav</dc:creator>
      <pubDate>Tue, 17 Mar 2026 13:41:32 +0000</pubDate>
      <link>https://dev.to/dharam_in/my-first-cicd-pipeline-with-yaml-and-docker-on-aws-1glh</link>
      <guid>https://dev.to/dharam_in/my-first-cicd-pipeline-with-yaml-and-docker-on-aws-1glh</guid>
      <description>&lt;p&gt;Hello everyone, today I want to share how I added my first CI/CD pipeline using YAML and Docker on AWS. First, I forked a React project on my GitHub because I didn’t want to waste time setting up React and adding a very simple app, so I decided to fork a project. Then I cloned that repository and added &lt;code&gt;.dockerignore&lt;/code&gt; and &lt;code&gt;Dockerfile&lt;/code&gt; files in my project’s root directory, and this is the code you can see in the screenshots:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frngm3wsoruez4kkezexn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frngm3wsoruez4kkezexn.png" alt=" " width="800" height="139"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, I created an EC2 instance to run my project and installed Docker. I added my Ubuntu user to Docker because Docker runs as root and the Ubuntu user doesn’t have access to that, so I added the user to the Docker group. Look at the screenshot I attached:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxy7nhm41zcuw6jqoni99.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxy7nhm41zcuw6jqoni99.png" alt=" " width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After that, I worked on the YAML for CI/CD. I created a &lt;code&gt;.github&lt;/code&gt; folder in the root directory of my project, then created another folder called &lt;code&gt;workflows&lt;/code&gt;, and in this folder I created a &lt;code&gt;deploy.yml&lt;/code&gt; file. In this file, first I added the project name, after that I added &lt;code&gt;on&lt;/code&gt; for when I push code to the main branch, then it triggers the action, and in the last I added my jobs. First, I used Ubuntu, then I checked out the code in that Ubuntu machine. After that, I copied this code to my EC2 machine, then SSH into my Ubuntu machine, then cd into my project, stop the running Docker container, build a new one, and run it. When I pushed the code, I saw my project was still not running, then I added an inbound rule in my EC2 machine because by default EC2 blocks other access points, so I added an inbound rule so everyone can access it.&lt;/p&gt;

&lt;p&gt;Look at the YAML code screenshot and running project screenshot:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxg76s8q2sdmg23mwcdgo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxg76s8q2sdmg23mwcdgo.png" alt=" " width="800" height="337"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw8wu9g3vupjj0yaq3gbt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw8wu9g3vupjj0yaq3gbt.png" alt=" " width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>actionshackathon</category>
      <category>aws</category>
      <category>cicd</category>
    </item>
    <item>
      <title>Learning Docker: Dockerfiles, .dockerignore, and Port Mapping 🐳</title>
      <dc:creator>Dharamraj Yadav</dc:creator>
      <pubDate>Sat, 07 Mar 2026 10:56:14 +0000</pubDate>
      <link>https://dev.to/dharam_in/learning-docker-dockerfiles-dockerignore-and-port-mapping-1g2n</link>
      <guid>https://dev.to/dharam_in/learning-docker-dockerfiles-dockerignore-and-port-mapping-1g2n</guid>
      <description>&lt;p&gt;Hey everyone! Here’s a quick update on what I learned last week. I finally got hands-on with two essential Docker files: the &lt;code&gt;Dockerfile&lt;/code&gt; and &lt;code&gt;.dockerignore&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;First up, let's talk about the &lt;code&gt;.dockerignore&lt;/code&gt; file. If you've used Git, this works exactly like &lt;code&gt;.gitignore&lt;/code&gt;. When we build an image, this file prevents Docker from copying over unnecessary files and folders, which helps keep our final image clean and lightweight.&lt;br&gt;
Here is my setup:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffs6pwfi6e1bjhn77c9cl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffs6pwfi6e1bjhn77c9cl.png" alt=" " width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, I created the &lt;code&gt;Dockerfile&lt;/code&gt;. This is basically the instruction manual for your project. We write down all the necessary commands in here, and Docker uses this file as the blueprint to build our custom image.&lt;br&gt;
Take a look at the code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28rlk7gs5kprpii59p7g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F28rlk7gs5kprpii59p7g.png" alt=" " width="800" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After building the image, it was time to run it. This is where I learned how &lt;strong&gt;port mapping&lt;/strong&gt; works. Port mapping is simply telling the Docker container, "Hey, forward your internal project port to this specific port on my local system."&lt;/p&gt;

&lt;p&gt;In my setup below, I mapped the ports so my project runs on port &lt;code&gt;5173&lt;/code&gt; inside the container's terminal, but I can actually access it in my local browser using port &lt;code&gt;3200&lt;/code&gt;.&lt;br&gt;
Check out the terminal and browser screenshots:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm714g8jdt4k2qsyyjjmn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm714g8jdt4k2qsyyjjmn.png" alt=" " width="800" height="95"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgkqicpp4ifivogmop9m4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgkqicpp4ifivogmop9m4.png" alt=" " width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>webdev</category>
      <category>programming</category>
      <category>containers</category>
    </item>
    <item>
      <title>Getting Started with Docker: Images, Containers, Volumes, and Networks 🐳</title>
      <dc:creator>Dharamraj Yadav</dc:creator>
      <pubDate>Tue, 24 Feb 2026 11:15:43 +0000</pubDate>
      <link>https://dev.to/dharam_in/getting-started-with-docker-images-containers-volumes-and-networks-2gcn</link>
      <guid>https://dev.to/dharam_in/getting-started-with-docker-images-containers-volumes-and-networks-2gcn</guid>
      <description>&lt;p&gt;Hello Everyone as part of my journey transitioning to DevSecOps, today i dove into Docker.&lt;/p&gt;

&lt;p&gt;In simple terms Docker is a software platform that allows you to build, test and deploy your applications quickly. Today i learned about four core concept of Docker, and i want to share my understanding with you all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Docker Images (The Blueprint)&lt;/strong&gt;&lt;br&gt;
An image is basically the blueprint for a container.We create this blueprint by writing some instructions inside a file called a &lt;strong&gt;&lt;em&gt;Dockerfile&lt;/em&gt;&lt;/strong&gt;. it contains everything your application needs to run - the code, runtime, libraries, and environment variables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Docker Container (The Running App)&lt;/strong&gt;&lt;br&gt;
If an image is a blueprint, then a container is the actual building. A container is simply the running instance of a Docker Image. You can start, stop, or delete a container anytime without affecting the original image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Docker Volume (Permanent Storage)&lt;/strong&gt;&lt;br&gt;
By default, data inside the container temporary. this is where a volume come in. Volumes provide permanent storage for your container's data by saving it directly to your hard drive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real World Example:&lt;/strong&gt; Suppose we host a database(like mongoDB) inside a container, and we have 1,000 users registered. if we delete or restart the container, all the users data will be lost. To prevent this we use a volume to safety store that database information permanently on the host machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Docker Network (The Communication Bridge)&lt;/strong&gt;&lt;br&gt;
When we create and run multiple containers at the same time, they are completely isolated from each other by default for security.&lt;br&gt;
However in real applications, they need to communicate. For example if i have a Node.js backend running in one container and a database in another container, they need to talk each other. We Use Docker Networks to create a secure connection between these isolated containers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My Journey Continues&lt;/strong&gt;&lt;br&gt;
Understanding these four concepts completely changed how I look at deployments. No more "&lt;em&gt;It work's on my machine&lt;/em&gt;".&lt;/p&gt;

</description>
      <category>docker</category>
      <category>containers</category>
      <category>beginners</category>
      <category>devops</category>
    </item>
    <item>
      <title>Hello World: My Journey from MERN Stack to DevSecOps 🚀</title>
      <dc:creator>Dharamraj Yadav</dc:creator>
      <pubDate>Sat, 21 Feb 2026 04:13:32 +0000</pubDate>
      <link>https://dev.to/dharam_in/hello-world-my-journey-from-mern-stack-to-devsecops-127m</link>
      <guid>https://dev.to/dharam_in/hello-world-my-journey-from-mern-stack-to-devsecops-127m</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;

&lt;p&gt;My name is Dharamraj Yadav, and this is my first post on this platform. I am currently working as a MERN Stack Developer, where I build web applications and craft APIs using Node.js. I have gained solid experience working across the MERN stack.&lt;/p&gt;

&lt;p&gt;Recently, I’ve been observing my seniors handle server management, specifically focusing on reducing AWS infrastructure costs. Watching them work over the last three months really inspired me. I realized that with a bit of effort, I have the confidence to learn these new concepts myself.&lt;/p&gt;

&lt;p&gt;So, I started using AI tools like Gemini to deeply understand how servers, deployments, and cloud infrastructure actually work.&lt;/p&gt;

&lt;p&gt;Now, I have officially decided to start my #LearnInPublic journey—transitioning from a MERN Stack Developer to DevSecOps. ⚙️🛡️&lt;/p&gt;

&lt;p&gt;Please connect with me to follow my journey, and stay tuned for more updates and learnings from the tech field!&lt;/p&gt;

&lt;h1&gt;
  
  
  DevSecOps #MERN #AWS #LearnInPublic #DevOpsJourney
&lt;/h1&gt;

</description>
      <category>devsecops</category>
      <category>devops</category>
      <category>aws</category>
      <category>mern</category>
    </item>
  </channel>
</rss>
