<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Day 07— Linux File Sys & Troubleshooting]]></title><description><![CDATA[Day 07— Linux File Sys & Troubleshooting]]></description><link>https://day-07-linux-file-sys-and-troubleshooting.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 18:53:56 GMT</lastBuildDate><atom:link href="https://day-07-linux-file-sys-and-troubleshooting.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[🐧 Day 07 — Linux File System & Real Troubleshooting Scenarios]]></title><description><![CDATA[When you first start using Linux, it feels confusing:

“Where are logs stored?”“Where do configuration files live?”“How do I start troubleshooting?”

Good news: Linux is not random.It has a clear structure, like a well-organized city 🏙️

Some places...]]></description><link>https://day-07-linux-file-sys-and-troubleshooting.hashnode.dev/day-07-linux-file-system-and-real-troubleshooting-scenarios</link><guid isPermaLink="true">https://day-07-linux-file-sys-and-troubleshooting.hashnode.dev/day-07-linux-file-system-and-real-troubleshooting-scenarios</guid><category><![CDATA[Devops  learning-in-public  ]]></category><dc:creator><![CDATA[Divyat Agrawal]]></dc:creator><pubDate>Thu, 29 Jan 2026 18:30:00 GMT</pubDate><content:encoded><![CDATA[<p>When you first start using Linux, it feels confusing:</p>
<blockquote>
<p>“Where are logs stored?”<br />“Where do configuration files live?”<br />“How do I start troubleshooting?”</p>
</blockquote>
<p>Good news: Linux is not random.<br />It has a <strong>clear structure</strong>, like a well-organized city 🏙️</p>
<ul>
<li><p>Some places store <strong>user files</strong></p>
</li>
<li><p>Some store <strong>system settings</strong></p>
</li>
<li><p>Some store <strong>logs</strong></p>
</li>
<li><p>Some store <strong>programs</strong></p>
</li>
</ul>
<p>Today you’ll learn:<br />✔ Where important things live in Linux<br />✔ How DevOps engineers find logs and configs<br />✔ How to solve real-world issues step by step</p>
<p>This is <strong>real DevOps thinking</strong>.</p>
<hr />
<h1 id="heading-part-1-linux-file-system-hierarchy-must-know">📁 PART 1 — Linux File System Hierarchy (Must Know)</h1>
<hr />
<h2 id="heading-root-directory-the-starting-point"><code>/</code> — Root Directory (The Starting Point)</h2>
<p>This is the <strong>top of the Linux file system</strong>. Everything starts here.</p>
<pre><code class="lang-plaintext">ls -l /
</code></pre>
<p>Think of <code>/</code> like the <strong>main entrance</strong> of a building.</p>
<p>👉 I would use this when exploring the <strong>overall system layout</strong>.</p>
<hr />
<h2 id="heading-home-user-home-directories"><code>/home</code> — User Home Directories</h2>
<p>Each normal user gets a folder here.</p>
<pre><code class="lang-plaintext">ls -l /home
</code></pre>
<p>Example:</p>
<pre><code class="lang-plaintext">student/
john/
devops/
</code></pre>
<p>This is where users keep their <strong>files, scripts, and projects</strong>.</p>
<p>👉 I would use this when working with <strong>user data</strong>.</p>
<hr />
<h2 id="heading-root-root-users-home"><code>/root</code> — Root User’s Home</h2>
<p>This is the home directory of the <strong>administrator (root)</strong>.</p>
<pre><code class="lang-plaintext">ls -l /root
</code></pre>
<p>This is like the <strong>admin office</strong> — normal users don’t have access.</p>
<p>👉 I would use this when doing <strong>system-level admin tasks</strong>.</p>
<hr />
<h2 id="heading-etc-configuration-files-system-control-room"><code>/etc</code> — Configuration Files (System Control Room)</h2>
<p>Almost all system and service settings live here.</p>
<pre><code class="lang-plaintext">ls -l /etc | head
cat /etc/hostname
</code></pre>
<p>Examples:</p>
<ul>
<li><p><code>/etc/ssh/sshd_config</code> → SSH settings</p>
</li>
<li><p><code>/etc/nginx/nginx.conf</code> → Web server settings</p>
</li>
</ul>
<p>👉 I would use this when <strong>changing service configurations</strong>.</p>
<hr />
<h2 id="heading-varlog-log-files-devops-gold-mine"><code>/var/log</code> — Log Files (DevOps Gold Mine)</h2>
<p>This is where system and application logs are stored.</p>
<pre><code class="lang-plaintext">ls -l /var/log | head
du -sh /var/log/* 2&gt;/dev/null | sort -h | tail -5
</code></pre>
<p>Logs tell you <strong>what went wrong and when</strong>.</p>
<p>👉 I would use this when <strong>troubleshooting service failures</strong>.</p>
<hr />
<h2 id="heading-tmp-temporary-files"><code>/tmp</code> — Temporary Files</h2>
<p>Temporary files are stored here and often deleted after reboot.</p>
<pre><code class="lang-plaintext">ls -l /tmp
</code></pre>
<p>👉 I would use this for <strong>testing or short-term work</strong>.</p>
<hr />
<h2 id="heading-bin-essential-commands"><code>/bin</code> — Essential Commands</h2>
<p>Core Linux commands like <code>ls</code>, <code>cp</code>, <code>mv</code> live here.</p>
<pre><code class="lang-plaintext">ls -l /bin | head
</code></pre>
<hr />
<h2 id="heading-usrbin-installed-programs"><code>/usr/bin</code> — Installed Programs</h2>
<p>Most user-installed programs are here.</p>
<pre><code class="lang-plaintext">ls -l /usr/bin | head
</code></pre>
<hr />
<h2 id="heading-opt-optional-third-party-software"><code>/opt</code> — Optional / Third-Party Software</h2>
<p>Custom or third-party software is often installed here.</p>
<pre><code class="lang-plaintext">ls -l /opt
</code></pre>
<hr />
<h1 id="heading-part-2-scenario-based-troubleshooting">🧠 PART 2 — Scenario-Based Troubleshooting</h1>
<p>Now we act like DevOps engineers solving real problems.</p>
<hr />
<h2 id="heading-scenario-1-service-not-starting">🔧 Scenario 1 — Service Not Starting</h2>
<p><strong>Problem:</strong> A service named <code>myapp</code> did not start after reboot.</p>
<h3 id="heading-step-1-check-service-status">Step 1 — Check Service Status</h3>
<pre><code class="lang-plaintext">systemctl status myapp
</code></pre>
<p>Shows if the service is <strong>running, stopped, or failed</strong>.</p>
<h3 id="heading-step-2-check-service-logs">Step 2 — Check Service Logs</h3>
<pre><code class="lang-plaintext">journalctl -u myapp -n 50
</code></pre>
<p>Shows last 50 log entries explaining <strong>why it failed</strong>.</p>
<h3 id="heading-step-3-check-if-it-starts-on-boot">Step 3 — Check If It Starts on Boot</h3>
<pre><code class="lang-plaintext">systemctl is-enabled myapp
</code></pre>
<p>Checks if the service is configured to <strong>start automatically</strong>.</p>
<h3 id="heading-step-4-confirm-service-exists">Step 4 — Confirm Service Exists</h3>
<pre><code class="lang-plaintext">systemctl list-units --type=service | grep myapp
</code></pre>
<hr />
<h2 id="heading-scenario-2-high-cpu-usage">🔥 Scenario 2 — High CPU Usage</h2>
<p><strong>Problem:</strong> Server feels slow.</p>
<h3 id="heading-step-1-view-live-cpu-usage">Step 1 — View Live CPU Usage</h3>
<pre><code class="lang-plaintext">top
</code></pre>
<p>Shows real-time CPU usage and running processes.</p>
<h3 id="heading-step-2-find-highest-cpu-process">Step 2 — Find Highest CPU Process</h3>
<pre><code class="lang-plaintext">ps aux --sort=-%cpu | head -10
</code></pre>
<p>Lists top CPU-consuming processes.</p>
<h3 id="heading-step-3-stop-problem-process">Step 3 — Stop Problem Process</h3>
<pre><code class="lang-plaintext">kill &lt;PID&gt;
</code></pre>
<p>Stops the heavy process (carefully).</p>
<hr />
<h1 id="heading-scenario-3-finding-service-logs-detailed">📜 Scenario 3 — Finding Service Logs (Detailed)</h1>
<p><strong>Problem:</strong> A developer asks: “Where are the logs for Docker?”</p>
<p>Docker is managed by <strong>systemd</strong>, so logs are in the <strong>system journal</strong>.</p>
<h3 id="heading-step-1-check-service-status-1">Step 1 — Check Service Status</h3>
<pre><code class="lang-plaintext">systemctl status docker
</code></pre>
<p>Confirms Docker is running and shows recent logs.</p>
<h3 id="heading-step-2-view-last-50-log-entries">Step 2 — View Last 50 Log Entries</h3>
<pre><code class="lang-plaintext">journalctl -u docker -n 50
</code></pre>
<p>Shows recent Docker errors or warnings.</p>
<h3 id="heading-step-3-follow-logs-live">Step 3 — Follow Logs Live</h3>
<pre><code class="lang-plaintext">journalctl -u docker -f
</code></pre>
<p>Shows logs in real time while Docker runs.</p>
<hr />
<h1 id="heading-scenario-4-file-permission-issue-detailed">🔒 Scenario 4 — File Permission Issue (Detailed)</h1>
<p><strong>Problem:</strong> Script gives “Permission denied”.</p>
<p>File:</p>
<pre><code class="lang-plaintext">/home/user/backup.sh
</code></pre>
<h3 id="heading-step-1-check-permissions">Step 1 — Check Permissions</h3>
<pre><code class="lang-plaintext">ls -l /home/user/backup.sh
</code></pre>
<p>If you see:</p>
<pre><code class="lang-plaintext">-rw-r--r--
</code></pre>
<p>There’s no <strong>x (execute permission)</strong>.</p>
<h3 id="heading-step-2-add-execute-permission">Step 2 — Add Execute Permission</h3>
<pre><code class="lang-plaintext">chmod +x /home/user/backup.sh
</code></pre>
<h3 id="heading-step-3-verify">Step 3 — Verify</h3>
<pre><code class="lang-plaintext">ls -l /home/user/backup.sh
</code></pre>
<p>Now you should see:</p>
<pre><code class="lang-plaintext">-rwxr-xr-x
</code></pre>
<h3 id="heading-step-4-run-script">Step 4 — Run Script</h3>
<pre><code class="lang-plaintext">./backup.sh
</code></pre>
<hr />
<h1 id="heading-why-this-matters-for-devops">✅ Why This Matters for DevOps</h1>
<p>You now understand:</p>
<p>✔ Where logs live<br />✔ Where configs live<br />✔ Where binaries live<br />✔ How to approach service, CPU, log, and permission issues</p>
]]></content:encoded></item></channel></rss>