<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Bash on MangoDriod</title><link>https://md.eknath.dev/categories/bash/</link><description>Recent content in Bash on MangoDriod</description><generator>Hugo -- 0.141.0</generator><language>en-us</language><lastBuildDate>Thu, 17 Jul 2025 22:46:54 +0530</lastBuildDate><atom:link href="https://md.eknath.dev/categories/bash/index.xml" rel="self" type="application/rss+xml"/><item><title>Mastering Grep: Your Guide to Efficient Text Searching</title><link>https://md.eknath.dev/posts/shell/grep-cmd-tool/</link><pubDate>Thu, 17 Jul 2025 22:46:54 +0530</pubDate><guid>https://md.eknath.dev/posts/shell/grep-cmd-tool/</guid><description>&lt;p>In the world of the command line, &lt;code>grep&lt;/code> is a tool you&amp;rsquo;ll find indispensable. It stands for &amp;ldquo;global regular expression print,&amp;rdquo; and it&amp;rsquo;s your go-to for searching text within files. Whether you&amp;rsquo;re a developer, a system administrator, or just someone who loves the terminal, mastering &lt;code>grep&lt;/code> will significantly boost your productivity. This article, inspired by the style of my &lt;a href="./basic-bash-commands.md">Basic Bash Commands&lt;/a> reference, will guide you through the essentials and advanced uses of &lt;code>grep&lt;/code>.&lt;/p></description><content:encoded><![CDATA[<p>In the world of the command line, <code>grep</code> is a tool you&rsquo;ll find indispensable. It stands for &ldquo;global regular expression print,&rdquo; and it&rsquo;s your go-to for searching text within files. Whether you&rsquo;re a developer, a system administrator, or just someone who loves the terminal, mastering <code>grep</code> will significantly boost your productivity. This article, inspired by the style of my <a href="./basic-bash-commands.md">Basic Bash Commands</a> reference, will guide you through the essentials and advanced uses of <code>grep</code>.</p>
<h2 id="what-is-grep">What is <code>grep</code>?</h2>
<p>At its core, <code>grep</code> is a command-line utility that searches for a specific pattern of text in a file or a stream of data. If it finds a match, it will print the line containing that pattern to the console. Its power lies in its simplicity and its support for regular expressions, which allows for incredibly flexible and powerful search queries.</p>
<h2 id="basic-syntax">Basic Syntax</h2>
<p>The basic syntax for <code>grep</code> is straightforward:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep <span style="color:#f92672">[</span>options<span style="color:#f92672">]</span> pattern <span style="color:#f92672">[</span>file...<span style="color:#f92672">]</span>
</span></span></code></pre></div><ul>
<li><code>[options]</code>: These are flags that modify the behavior of <code>grep</code>.</li>
<li><code>pattern</code>: This is the text or regular expression you are searching for.</li>
<li><code>[file...]</code>: This is the file or files you want to search in. If no file is specified, <code>grep</code> will search the standard input.</li>
</ul>
<h2 id="daily-use-cases">Daily Use Cases</h2>
<p>Here are some of the most common ways you&rsquo;ll use <code>grep</code> in your day-to-day tasks:</p>
<h3 id="simple-text-search">Simple Text Search</h3>
<p>The most basic use of <code>grep</code> is to search for a specific word in a file.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep <span style="color:#e6db74">&#34;error&#34;</span> log.txt
</span></span></code></pre></div><p>This command will search for the word &ldquo;error&rdquo; in the <code>log.txt</code> file and print all lines that contain it.</p>
<h3 id="case-insensitive-search">Case-Insensitive Search</h3>
<p>If you want to ignore the case of the text you&rsquo;re searching for, use the <code>-i</code> option.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep -i <span style="color:#e6db74">&#34;error&#34;</span> log.txt
</span></span></code></pre></div><p>This will find &ldquo;error&rdquo;, &ldquo;Error&rdquo;, &ldquo;ERROR&rdquo;, and so on.</p>
<h3 id="searching-in-multiple-files">Searching in Multiple Files</h3>
<p>You can search for a pattern in multiple files by listing them after the pattern.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep <span style="color:#e6db74">&#34;api_key&#34;</span> config.yml settings.py
</span></span></code></pre></div><h3 id="recursive-search">Recursive Search</h3>
<p>To search for a pattern in all files within a directory and its subdirectories, use the <code>-r</code> option.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep -r <span style="color:#e6db74">&#34;database_url&#34;</span> .
</span></span></code></pre></div><p>This is incredibly useful for finding where a particular variable or function is used in a large project.</p>
<h2 id="medium-complexity-use-cases">Medium Complexity Use Cases</h2>
<p>Once you&rsquo;re comfortable with the basics, you can start using <code>grep</code> for more complex tasks.</p>
<h3 id="inverting-the-search">Inverting the Search</h3>
<p>If you want to find all the lines that <em>don&rsquo;t</em> contain a pattern, use the <code>-v</code> option.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep -v <span style="color:#e6db74">&#34;success&#34;</span> log.txt
</span></span></code></pre></div><p>This is useful for filtering out noise from log files.</p>
<h3 id="counting-matches">Counting Matches</h3>
<p>To count the number of lines that match a pattern, use the <code>-c</code> option.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep -c <span style="color:#e6db74">&#34;warning&#34;</span> log.txt
</span></span></code></pre></div><h3 id="showing-line-numbers">Showing Line Numbers</h3>
<p>To display the line number of each match, use the <code>-n</code> option.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep -n <span style="color:#e6db74">&#34;TODO&#34;</span> *.py
</span></span></code></pre></div><p>This helps you quickly jump to the relevant line in your code editor.</p>
<h2 id="advanced-grep-with-regular-expressions">Advanced <code>grep</code> with Regular Expressions</h2>
<p>The true power of <code>grep</code> is unlocked when you use it with regular expressions. Here are a few examples:</p>
<h3 id="matching-the-start-and-end-of-a-line">Matching the Start and End of a Line</h3>
<p>You can use <code>^</code> to match the beginning of a line and <code>$</code> to match the end.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep <span style="color:#e6db74">&#34;^import&#34;</span> *.py  <span style="color:#75715e"># Find all lines that start with &#34;import&#34;</span>
</span></span><span style="display:flex;"><span>grep <span style="color:#e6db74">&#34;)</span>$<span style="color:#e6db74">&#34;</span> *.js      <span style="color:#75715e"># Find all lines that end with &#34;)&#34;</span>
</span></span></code></pre></div><h3 id="matching-any-character">Matching Any Character</h3>
<p>The <code>.</code> character in a regular expression matches any single character.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep <span style="color:#e6db74">&#34;gr.p&#34;</span> words.txt <span style="color:#75715e"># Matches &#34;grep&#34;, &#34;grip&#34;, &#34;grap&#34;, etc.</span>
</span></span></code></pre></div><h3 id="using-character-classes">Using Character Classes</h3>
<p>You can use character classes to match a set of characters.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep <span style="color:#e6db74">&#34;[aeiou]&#34;</span> text.txt <span style="color:#75715e"># Find all lines with at least one vowel</span>
</span></span></code></pre></div><h2 id="combining-grep-with-other-commands">Combining <code>grep</code> with Other Commands</h2>
<p><code>grep</code> is often used with other commands to create powerful command-line pipelines.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>ps aux | grep <span style="color:#e6db74">&#34;nginx&#34;</span> <span style="color:#75715e"># Find all running processes with &#34;nginx&#34; in their name</span>
</span></span></code></pre></div><p>This command takes the output of <code>ps aux</code> and uses <code>grep</code> to filter it.</p>
<h2 id="conclusion">Conclusion</h2>
<p><code>grep</code> is a versatile and powerful tool that is essential for anyone who works with the command line. From simple text searches to complex pattern matching with regular expressions, <code>grep</code> can handle it all.</p>
<p>Thank you</p>
]]></content:encoded></item><item><title>Recommended Command Line Tools</title><link>https://md.eknath.dev/posts/shell/command-line-tools/</link><pubDate>Tue, 17 Jun 2025 22:46:54 +0530</pubDate><guid>https://md.eknath.dev/posts/shell/command-line-tools/</guid><description>&lt;p>The terminal is already a powerful tool, but the right command-line utilities can make it even better. Here are a few essential tools I use daily that you might find helpful too.&lt;/p>
&lt;h2 id="homebrew">HomeBrew&lt;/h2>
&lt;p>Homebrew is a package manager for macOS (and Linux) that lets you easily install, update, and manage software and developer tools from the command line.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Installation command&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>/bin/bash -c &lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh&lt;span style="color:#66d9ef">)&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>After running the command, restart your terminal, and you&amp;rsquo;re good to go. Before we start installing, let&amp;rsquo;s understand the difference between a &amp;ldquo;formula&amp;rdquo; and a &amp;ldquo;cask&amp;rdquo; in Homebrew.&lt;/p></description><content:encoded><![CDATA[<p>The terminal is already a powerful tool, but the right command-line utilities can make it even better. Here are a few essential tools I use daily that you might find helpful too.</p>
<h2 id="homebrew">HomeBrew</h2>
<p>Homebrew is a package manager for macOS (and Linux) that lets you easily install, update, and manage software and developer tools from the command line.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Installation command</span>
</span></span><span style="display:flex;"><span>/bin/bash -c <span style="color:#e6db74">&#34;</span><span style="color:#66d9ef">$(</span>curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh<span style="color:#66d9ef">)</span><span style="color:#e6db74">&#34;</span>
</span></span></code></pre></div><p>After running the command, restart your terminal, and you&rsquo;re good to go. Before we start installing, let&rsquo;s understand the difference between a &ldquo;formula&rdquo; and a &ldquo;cask&rdquo; in Homebrew.</p>
<p><strong>Formula:</strong> Command-line tools, libraries, and languages (e.g., Kotlin, Go). No special flags are needed when using <code>brew</code> commands with formulas. <a href="https://formulae.brew.sh/formula/">All Formulas</a></p>
<p><strong>Cask:</strong> GUI applications like Chrome, VSCode, etc. These require a <code>--cask</code> flag for <code>brew</code> operations. <a href="https://formulae.brew.sh/cask/">Cask Directory</a></p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>brew install git             <span style="color:#75715e"># Installing a formula</span>
</span></span><span style="display:flex;"><span>brew install --cask firefox  <span style="color:#75715e"># Installing a cask</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>brew uninstall foo           <span style="color:#75715e"># Remove a package</span>
</span></span><span style="display:flex;"><span>brew upgrade foo             <span style="color:#75715e"># Upgrade a specific package</span>
</span></span><span style="display:flex;"><span>brew list                    <span style="color:#75715e"># See all installed packages</span>
</span></span><span style="display:flex;"><span>brew search foo              <span style="color:#75715e"># Find available packages</span>
</span></span><span style="display:flex;"><span>brew info foo                <span style="color:#75715e"># Get details about a package</span>
</span></span><span style="display:flex;"><span>brew update                  <span style="color:#75715e"># Update Homebrew&#39;s package list</span>
</span></span><span style="display:flex;"><span>brew upgrade                 <span style="color:#75715e"># Upgrade all outdated packages</span>
</span></span></code></pre></div><p>🔗 <a href="https://brew.sh/">HomeBrew-Official</a></p>
<h2 id="ollama---local-and-opensource-llms">Ollama - Local and OpenSource LLMs</h2>
<p>This is an incredibly useful tool that I find myself using constantly. Local models are fantastic for answering general or timeless questions where you need accuracy without requiring up-to-the-minute data. They’re fast, private, work offline, and have another big advantage: 🌱 a reduced environmental impact.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li>Install Ollama by running the official script in your terminal. If you prefer, you can also download it manually from the <a href="https://ollama.com/download">official site</a>.
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>curl -fsSL https://ollama.com/install.sh | sh
</span></span></code></pre></div></li>
<li>Browse the <a href="https://ollama.com/search">Model Library</a> to find a model. Keep an eye on the size, as some models can be several gigabytes.</li>
<li>Once you&rsquo;ve picked a model, pull it using the <code>pull</code> command. For example, to get the Llama 3 model:
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>ollama pull llama3
</span></span></code></pre></div></li>
<li>After the download is complete, you can run the model to start a chat session. To exit, just type <code>/bye</code>.
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>ollama run llama3
</span></span></code></pre></div></li>
</ol>
<p>That&rsquo;s it! Now, anytime you have a question, you can just run <code>ollama run &lt;model_name&gt;</code> to interact with your local LLM.</p>
<table>
  <thead>
      <tr>
          <th>Command</th>
          <th>Description</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>ollama serve</code></td>
          <td>Starts the Ollama server (for API access).</td>
      </tr>
      <tr>
          <td><code>ollama create &lt;model&gt;</code></td>
          <td>Creates a new model from a Modelfile.</td>
      </tr>
      <tr>
          <td><code>ollama show &lt;model&gt;</code></td>
          <td>Displays details about a model.</td>
      </tr>
      <tr>
          <td><code>ollama run &lt;model&gt;</code></td>
          <td>Runs a model for interactive chat.</td>
      </tr>
      <tr>
          <td><code>ollama pull &lt;model&gt;</code></td>
          <td>Downloads a model from the library.</td>
      </tr>
      <tr>
          <td><code>ollama list</code></td>
          <td>Lists all downloaded models.</td>
      </tr>
      <tr>
          <td><code>ollama ps</code></td>
          <td>Shows currently running models.</td>
      </tr>
      <tr>
          <td><code>ollama stop &lt;model&gt;</code></td>
          <td>Stops a running model.</td>
      </tr>
      <tr>
          <td><code>ollama rm &lt;model&gt;</code></td>
          <td>Removes a model from your system.</td>
      </tr>
  </tbody>
</table>
<p>Here is an example of how you can download and run another model in one line:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>ollama pull mistral <span style="color:#f92672">&amp;&amp;</span> ollama run mistral
</span></span></code></pre></div><p>🔗 <a href="https://ollama.com/">Ollama</a></p>
<h2 id="gemini-cli">Gemini-cli</h2>
<p>Gemini CLI is an open-source tool that brings the power of Google&rsquo;s Gemini models directly into your terminal. It provides lightweight, direct access to the API, making it a versatile utility for a wide range of tasks, from coding and content generation to problem-solving and research.</p>
<h3 id="installation">Installation</h3>
<ol>
<li>Ensure you have Node.js (version 18+). You can check with <code>node -v</code>. If you don&rsquo;t have it, install it with Homebrew:
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>brew install node
</span></span></code></pre></div></li>
<li>Install the Gemini CLI globally using npm:
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>npm install -g @google/gemini-cli
</span></span></code></pre></div></li>
<li>Run the setup and authentication command:
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>gemini
</span></span></code></pre></div>Follow the prompts to choose a theme and log in with your Google account.</li>
</ol>
<p><strong>Troubleshooting Tip:</strong> On some systems, the authentication flow in the terminal might not complete. If this happens, run <code>gemini</code> again, and then check your default web browser for the Google authentication page to complete the login.</p>
<p>⚠️ Unlike Ollama, only the <em>tool</em> is open-source, not the model. Your prompts and data will be processed by Google&rsquo;s servers.</p>
<p>⚠️ The free tier has a rate limit (e.g., 60 requests per minute). You can upgrade to a paid plan to overcome this.</p>
<h3 id="common-commands">Common Commands</h3>
<ul>
<li><code>/chat save &lt;name&gt;</code>: Saves your current chat with a memorable name.</li>
<li><code>/chat list</code>: Lists all your saved chats.</li>
<li><code>/chat resume &lt;name&gt;</code>: Resumes a saved chat session.</li>
<li><code>/compress</code>: Replaces the current chat context with a summary to save tokens.</li>
<li><code>/auth</code>: Manages your authentication settings.</li>
<li><code>/quit</code> or <code>/exit</code>: Exits the tool.</li>
</ul>
<h3 id="switching-to-shell-mode">Switching to Shell Mode</h3>
<p>You can input <code>!</code> to toggle shell mode. For example, type <code>!pwd</code> to see your current directory. The theme will change to indicate you&rsquo;re in shell mode. To return to the chat, just input <code>!</code> again.</p>
<h3 id="providing-context">Providing Context</h3>
<p>Use the <code>@</code> symbol to provide file or directory context for your prompts.</p>
<ul>
<li><code>@path/to/your/file.txt Explain this text file.</code></li>
<li><code>@src/my_project/ Summarize the code in this directory.</code></li>
</ul>
<p>You can find more commands in the <a href="https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/commands.md">official documentation</a>.</p>
<p><a href="https://github.com/google-gemini/gemini-cli?tab=readme-ov-file">Gemini CLI-Github repo</a></p>
<h2 id="duckduckgo">DuckDuckGo</h2>
<p>Sometimes you just need to verify things quickly with a search engine. <code>ddgr</code> brings the DuckDuckGo search engine to your CLI, delivering fast results.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Installation</span>
</span></span><span style="display:flex;"><span>brew install ddgr
</span></span></code></pre></div><h3 id="common-commands-1">Common Commands</h3>
<p>These are the commands you&rsquo;ll likely use most often:</p>
<table>
  <thead>
      <tr>
          <th>Command</th>
          <th>Description</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>ddgr &lt;query&gt;</code></td>
          <td>Perform a search.</td>
      </tr>
      <tr>
          <td><code>ddgr -n &lt;num&gt; &lt;query&gt;</code></td>
          <td>Limit the number of search results.</td>
      </tr>
      <tr>
          <td><code>ddgr -j &lt;query&gt;</code></td>
          <td>Open the first result directly in the browser.</td>
      </tr>
      <tr>
          <td><code>ddgr -w &lt;site&gt; &lt;query&gt;</code></td>
          <td>Restrict the search to a specific site.</td>
      </tr>
      <tr>
          <td><code>ddgr -s &lt;region&gt; &lt;query&gt;</code></td>
          <td>Set the search region (e.g., <code>us-en</code>).</td>
      </tr>
      <tr>
          <td><code>ddgr -x &lt;query&gt;</code></td>
          <td>Display URLs only, without opening a browser.</td>
      </tr>
      <tr>
          <td><code>ddgr -C &lt;query&gt;</code></td>
          <td>Colorize the output for easier reading.</td>
      </tr>
      <tr>
          <td><code>ddgr -l</code></td>
          <td>List your search history.</td>
      </tr>
      <tr>
          <td><code>ddgr -c</code></td>
          <td>Clear your search history.</td>
      </tr>
      <tr>
          <td><code>ddgr --disable-safe</code></td>
          <td>Disable safe search filtering.</td>
      </tr>
      <tr>
          <td><code>ddgr -h</code></td>
          <td>Show the help menu.</td>
      </tr>
  </tbody>
</table>
<h3 id="navigation-commands">navigation Commands</h3>
<p>When results are displayed, you can use these keys to navigate:</p>
<table>
  <thead>
      <tr>
          <th>Shortcut / Action</th>
          <th>What it does</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>[number]</code></td>
          <td>Open the result with that number in your browser.</td>
      </tr>
      <tr>
          <td><code>n</code> or <code>N</code></td>
          <td>Show the next page of results.</td>
      </tr>
      <tr>
          <td><code>p</code> or <code>P</code></td>
          <td>Show the previous page of results.</td>
      </tr>
      <tr>
          <td><code>o [numbers]</code></td>
          <td>Open multiple results (e.g., <code>o 1 3 5</code>).</td>
      </tr>
      <tr>
          <td><code>q</code></td>
          <td>Quit ddgr.</td>
      </tr>
  </tbody>
</table>
<p>Here’s an example I use extensively:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Shows 5 results from GitHub for &#34;awesome shell scripts&#34;</span>
</span></span><span style="display:flex;"><span>ddgr -n <span style="color:#ae81ff">5</span> -w github.com <span style="color:#e6db74">&#34;awesome shell scripts&#34;</span>
</span></span></code></pre></div><h3 id="profile-configuration">Profile Configuration</h3>
<p>You can customize <code>ddgr</code>&rsquo;s default behavior by editing the <code>~/.ddgrrc</code> file (<code>vi ~/.ddgrrc</code>). Here are some of the options you can configure:</p>
<table>
  <thead>
      <tr>
          <th>Option</th>
          <th>Description</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>-n &lt;number&gt;</code></td>
          <td>Set the default number of search results per page.</td>
      </tr>
      <tr>
          <td><code>-C</code></td>
          <td>Enable colorized output.</td>
      </tr>
      <tr>
          <td><code>--disable-safe</code></td>
          <td>Disable safe search.</td>
      </tr>
      <tr>
          <td><code>-x</code></td>
          <td>Show URLs only by default.</td>
      </tr>
      <tr>
          <td><code>-r &lt;browser&gt;</code></td>
          <td>Set the browser for opening results (e.g., <code>firefox</code>).</td>
      </tr>
      <tr>
          <td><code>-s &lt;region&gt;</code></td>
          <td>Set the default search region (e.g., <code>us-en</code>).</td>
      </tr>
      <tr>
          <td><code>-w &lt;site&gt;</code></td>
          <td>Restrict searches to a specific site by default.</td>
      </tr>
      <tr>
          <td><code>--json</code></td>
          <td>Output results in JSON format (useful for scripting).</td>
      </tr>
  </tbody>
</table>
<p>🔗 <a href="https://github.com/jarun/ddgr">ddgr-Repo</a></p>
<h2 id="git-cli">Git CLI</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>brew install git
</span></span></code></pre></div><p>I&rsquo;m sure you&rsquo;re familiar with the basic git commands, but you can create powerful aliases to make your workflow faster. For example, you can run <code>git st</code> instead of <code>git status</code>.</p>
<ol>
<li>Find your global git config file by running <code>git config --list --show-origin</code>.</li>
<li>Open that file (e.g., <code>vi ~/.gitconfig</code>) and add your aliases.</li>
</ol>
<p>Here is an example <code>~/.gitconfig</code> file:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-ini" data-lang="ini"><span style="display:flex;"><span><span style="color:#66d9ef">[credential]</span>
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">helper</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">store</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">[user]</span>
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">name</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">Eganathan R
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    email = md-email@gmail.com</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">[filter &#34;lfs&#34;]</span>
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">smudge</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">git-lfs smudge -- %f
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    process = git-lfs filter-process
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    required = true
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    clean = git-lfs clean -- %f</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">[init]</span>
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">defaultBranch</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">master</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">[http]</span>
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">proxy</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">http://127.0.0.1:xxxx</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">[alias]</span>
</span></span><span style="display:flex;"><span>    <span style="color:#a6e22e">st</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">status
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    co = checkout
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    br = branch
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    ci = commit
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    lg = log --oneline --graph --decorate # Pretty and compact log view</span>
</span></span></code></pre></div><h2 id="podman-optional">Podman (Optional)</h2>
<p>Podman is a powerful, daemonless(It does not require a background service) container engine for developing, managing, and running containers. It provides a command-line interface that is compatible with Docker, making it an excellent alternative for container management without requiring a central daemon, i most use podman only for experimentation.</p>
<h3 id="installation-1">Installation</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>brew install podman
</span></span></code></pre></div><p>After installation, you may need to initialize a Podman machine, which is a lightweight virtual machine for running containers on macOS.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>podman machine init
</span></span><span style="display:flex;"><span>podman machine start
</span></span></code></pre></div><h3 id="common-commands-2">Common Commands</h3>
<p>Many Podman commands are identical to their Docker counterparts, so you can often use <code>podman</code> as a drop-in replacement for <code>docker</code>.</p>
<table>
  <thead>
      <tr>
          <th>Command</th>
          <th>Description</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>podman pull &lt;image&gt;</code></td>
          <td>Pull an image from a container registry.</td>
      </tr>
      <tr>
          <td><code>podman push &lt;image&gt;</code></td>
          <td>Push an image to a container registry.</td>
      </tr>
      <tr>
          <td><code>podman build -t &lt;tag&gt; .</code></td>
          <td>Build an image from a Dockerfile.</td>
      </tr>
      <tr>
          <td><code>podman images</code></td>
          <td>List all local images.</td>
      </tr>
      <tr>
          <td><code>podman run &lt;image&gt;</code></td>
          <td>Run a command in a new container.</td>
      </tr>
      <tr>
          <td><code>podman ps</code></td>
          <td>List all running containers.</td>
      </tr>
      <tr>
          <td><code>podman ps -a</code></td>
          <td>List all containers (running and stopped).</td>
      </tr>
      <tr>
          <td><code>podman stop &lt;container&gt;</code></td>
          <td>Stop one or more running containers.</td>
      </tr>
      <tr>
          <td><code>podman rm &lt;container&gt;</code></td>
          <td>Remove one or more containers.</td>
      </tr>
      <tr>
          <td><code>podman rmi &lt;image&gt;</code></td>
          <td>Remove one or more images.</td>
      </tr>
      <tr>
          <td><code>podman machine list</code></td>
          <td>List available Podman virtual machines.</td>
      </tr>
      <tr>
          <td><code>podman machine stop</code></td>
          <td>Stop the Podman virtual machine.</td>
      </tr>
  </tbody>
</table>
<p>🔗 <a href="https://podman.io/">Podman-Official</a></p>
<p>I&rsquo;m certain this will help you. There are many other interesting command-line tools out there (like <code>starship</code>, <code>tmux</code>), but I consider them more for customization.</p>
<p>Thanks for reading, and have a great day ☺️</p>
]]></content:encoded></item><item><title>Basic Bash Commands</title><link>https://md.eknath.dev/posts/shell/basic-bash-commands/</link><pubDate>Wed, 11 Jun 2025 20:46:54 +0530</pubDate><guid>https://md.eknath.dev/posts/shell/basic-bash-commands/</guid><description>&lt;p>One of my mentors, &lt;a href="https://linktr.ee/rwxrob">RWX-Rob&lt;/a>, runs online bootcamps called Boost, where he shares tech industry standards. A key lesson he emphasizes is the importance of learning Linux and working with its Bash command-line. Mastering the terminal has helped me save time and stay focused. These are my quick reference notes — not an exhaustive list, but the commands I use most often and im sure it will be useful for you too.&lt;/p></description><content:encoded><![CDATA[<p>One of my mentors, <a href="https://linktr.ee/rwxrob">RWX-Rob</a>, runs online bootcamps called Boost, where he shares tech industry standards. A key lesson he emphasizes is the importance of learning Linux and working with its Bash command-line. Mastering the terminal has helped me save time and stay focused. These are my quick reference notes — not an exhaustive list, but the commands I use most often and im sure it will be useful for you too.</p>
<p>btw BASH is short for Bourne Again SHell, just in case some one asks, so lets move it:</p>
<h2 id="mac-switching-between-zsh-and-bash">Mac Switching between Zsh and Bash</h2>
<p>As a software developer, choose <strong>Bash</strong> if you&rsquo;re new to shell scripting due to its familiarity and abundance of online resources, while opting for <strong>Zsh</strong> for improved performance, customization, and
security features, keeping in mind that switching to Zsh might require adapting to some differences when working with Linux distributions.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>chsh -s /bin/bash  <span style="color:#75715e"># switch to bash</span>
</span></span><span style="display:flex;"><span>chsh -s /bin/zsh   <span style="color:#75715e"># Switch to zsh</span>
</span></span></code></pre></div><h2 id="identity">Identity</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>pwd             <span style="color:#75715e"># Print current working directory</span>
</span></span><span style="display:flex;"><span>whoami          <span style="color:#75715e"># Show current user</span>
</span></span><span style="display:flex;"><span>clear           <span style="color:#75715e"># Clear the terminal screen</span>
</span></span><span style="display:flex;"><span>history         <span style="color:#75715e"># Show command history</span>
</span></span></code></pre></div><h2 id="file--directory-navigation">File &amp; Directory Navigation</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>ls              <span style="color:#75715e"># List files</span>
</span></span><span style="display:flex;"><span>ls -la          <span style="color:#75715e"># List all files with details</span>
</span></span><span style="display:flex;"><span>cd /path/to/dir <span style="color:#75715e"># Change directory</span>
</span></span><span style="display:flex;"><span>cd ..           <span style="color:#75715e"># Go up one directory</span>
</span></span><span style="display:flex;"><span>cd -            <span style="color:#75715e"># Go to previous directory</span>
</span></span></code></pre></div><h2 id="file-operations">File Operations</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>touch file.txt              <span style="color:#75715e"># Create a new empty file</span>
</span></span><span style="display:flex;"><span>mkdir folder                <span style="color:#75715e"># Create a new directory</span>
</span></span><span style="display:flex;"><span>cp file1.txt file2.txt      <span style="color:#75715e"># Copy file or dir</span>
</span></span><span style="display:flex;"><span>mv file1.txt file2.txt      <span style="color:#75715e"># Rename or move file or dir</span>
</span></span><span style="display:flex;"><span>rm file.txt                 <span style="color:#75715e"># Delete file </span>
</span></span><span style="display:flex;"><span>rm -r folder                <span style="color:#75715e"># Delete directory recursively</span>
</span></span></code></pre></div><h2 id="searching--finding">Searching &amp; Finding</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>grep <span style="color:#e6db74">&#34;text&#34;</span> file.txt        <span style="color:#75715e"># Search for text in a file</span>
</span></span><span style="display:flex;"><span>grep -r <span style="color:#e6db74">&#34;text&#34;</span> .            <span style="color:#75715e"># Recursive search in directory</span>
</span></span><span style="display:flex;"><span>find . -name <span style="color:#e6db74">&#34;*.sh&#34;</span>         <span style="color:#75715e"># Find all .sh files</span>
</span></span></code></pre></div><h2 id="editing-files">Editing Files</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>vi file.txt                 <span style="color:#75715e"># Open file in Vim editor (i don&#39;t like nano sorry!) </span>
</span></span><span style="display:flex;"><span>cat file.txt                <span style="color:#75715e"># Print file content</span>
</span></span><span style="display:flex;"><span>less file.txt               <span style="color:#75715e"># Scroll through file</span>
</span></span><span style="display:flex;"><span>head file.txt               <span style="color:#75715e"># First 10 lines</span>
</span></span><span style="display:flex;"><span>tail file.txt               <span style="color:#75715e"># Last 10 lines</span>
</span></span></code></pre></div><ul>
<li>Vim Editor has its own commands and pallets, will add my reference here.</li>
</ul>
<h2 id="manual">Manual</h2>
<p>The <code>man</code> command provides access to the manual pages for other commands, offering detailed information on their usage and options.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>man ls <span style="color:#75715e"># show the manual for ls command</span>
</span></span></code></pre></div><h2 id="permissions">Permissions</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>chmod +x script.sh          <span style="color:#75715e"># Make script executable</span>
</span></span><span style="display:flex;"><span>chmod <span style="color:#ae81ff">755</span> file              <span style="color:#75715e"># Set permissions (owner rwx, others rx)</span>
</span></span><span style="display:flex;"><span>chown user:group file       <span style="color:#75715e"># Change ownership</span>
</span></span><span style="display:flex;"><span>ls -l file                  <span style="color:#75715e"># Get info of file permissions and owner etc</span>
</span></span><span style="display:flex;"><span>ls -ld folder               <span style="color:#75715e"># Get info of folder permissions and owner etc</span>
</span></span></code></pre></div><h3 id="permissions-string-quick-reference">Permissions String Quick Reference</h3>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>-rw-r--r-- <span style="color:#ae81ff">1</span> user group <span style="color:#ae81ff">1234</span> Jun <span style="color:#ae81ff">16</span> 19:00 myfile.txt <span style="color:#75715e"># Example output for ls -l file check the table for ref</span>
</span></span><span style="display:flex;"><span>drwxr-xr-x <span style="color:#ae81ff">2</span> user group <span style="color:#ae81ff">4096</span> Jun <span style="color:#ae81ff">16</span> 19:00 mydir <span style="color:#75715e"># Example output for ls -ld folder check the table for ref</span>
</span></span></code></pre></div><table>
  <thead>
      <tr>
          <th>Position</th>
          <th>Meaning</th>
          <th>Example</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>1st char</td>
          <td>File type (<code>-</code> file, <code>d</code> directory, <code>l</code> symlink)</td>
          <td><code>-</code> = file, <code>d</code> = directory</td>
      </tr>
      <tr>
          <td>2-4</td>
          <td>Owner permissions (read <code>r</code>, write <code>w</code>, execute <code>x</code>)</td>
          <td><code>rwx</code> = owner can read, write, execute</td>
      </tr>
      <tr>
          <td>5-7</td>
          <td>Group permissions</td>
          <td><code>r-x</code> = group can read, execute</td>
      </tr>
      <tr>
          <td>8-10</td>
          <td>Others permissions</td>
          <td><code>r--</code> = others can only read</td>
      </tr>
  </tbody>
</table>
<h2 id="scripts--variables">Scripts &amp; Variables</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e">#!/bin/bash
</span></span></span><span style="display:flex;"><span><span style="color:#75715e"></span>echo <span style="color:#e6db74">&#34;Hello, </span>$USER<span style="color:#e6db74">&#34;</span>         <span style="color:#75715e"># Sample Bash script</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Variables</span>
</span></span><span style="display:flex;"><span>name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;Eganathan&#34;</span>
</span></span><span style="display:flex;"><span>echo <span style="color:#e6db74">&#34;Hi, </span>$name<span style="color:#e6db74">&#34;</span>
</span></span></code></pre></div><h2 id="loops--conditions">Loops &amp; Conditions</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># If</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">if</span> <span style="color:#f92672">[</span> -f <span style="color:#e6db74">&#34;file.txt&#34;</span> <span style="color:#f92672">]</span>; <span style="color:#66d9ef">then</span>
</span></span><span style="display:flex;"><span>  echo <span style="color:#e6db74">&#34;Exists&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">fi</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># For loop</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">for</span> f in *.txt; <span style="color:#66d9ef">do</span>
</span></span><span style="display:flex;"><span>  echo <span style="color:#e6db74">&#34;</span>$f<span style="color:#e6db74">&#34;</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">done</span>
</span></span></code></pre></div><h2 id="time-savers">Time Savers</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>!!              <span style="color:#75715e"># Repeat last command</span>
</span></span><span style="display:flex;"><span>!abc            <span style="color:#75715e"># Run last command starting with &#39;abc&#39;</span>
</span></span><span style="display:flex;"><span>Ctrl + R        <span style="color:#75715e"># Reverse search command history</span>
</span></span><span style="display:flex;"><span>Ctrl + L        <span style="color:#75715e"># Clear screen (same as `clear`)</span>
</span></span><span style="display:flex;"><span>Ctrl + A / E    <span style="color:#75715e"># Move to beginning / end of line</span>
</span></span></code></pre></div><h2 id="date-time">Date Time</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>date <span style="color:#75715e"># Print current date and time</span>
</span></span><span style="display:flex;"><span>date +<span style="color:#e6db74">&#34;%T&#34;</span>        <span style="color:#75715e"># Print current time in 24-hour format (HH:MM:SS)</span>
</span></span><span style="display:flex;"><span>date +<span style="color:#e6db74">&#34;%r&#34;</span>        <span style="color:#75715e"># Print current time in 12-hour format with AM/PM</span>
</span></span><span style="display:flex;"><span>date +<span style="color:#e6db74">&#34;%F&#34;</span>        <span style="color:#75715e"># Print current date in YYYY-MM-DD format</span>
</span></span><span style="display:flex;"><span>date +<span style="color:#e6db74">&#34;%d-%m-%Y&#34;</span>  <span style="color:#75715e"># Print current date in custom format: Day Month Year</span>
</span></span><span style="display:flex;"><span>date -u           <span style="color:#75715e"># Print current UTC time</span>
</span></span></code></pre></div><h2 id="use-alias-to-create-shortcuts">Use alias to create shortcuts</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>alias gs<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;git status&#34;</span> <span style="color:#75715e"># hope you have git installed</span>
</span></span><span style="display:flex;"><span>alias ..<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;cd ..&#34;</span> <span style="color:#75715e"># this have saved a quite a lot of time for me</span>
</span></span></code></pre></div><h2 id="combine-commands">Combine commands</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>command1 <span style="color:#f92672">&amp;&amp;</span> command2  <span style="color:#75715e"># Run command2 only if command1 succeeds</span>
</span></span><span style="display:flex;"><span>command1 <span style="color:#f92672">||</span> command2  <span style="color:#75715e"># Run command2 only if command1 fails</span>
</span></span></code></pre></div><h2 id="copy-file-contents">copy file contents</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>cat file.txt | pbcopy
</span></span></code></pre></div><h2 id="cleaning">Cleaning</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span>df -h           <span style="color:#75715e"># Disk usage</span>
</span></span><span style="display:flex;"><span>du -sh *        <span style="color:#75715e"># Folder sizes</span>
</span></span><span style="display:flex;"><span>top             <span style="color:#75715e"># Real-time process list</span>
</span></span><span style="display:flex;"><span>ps aux | grep xyz  <span style="color:#75715e"># Check if a process is running</span>
</span></span></code></pre></div><h2 id="configuration-files">Configuration Files</h2>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Bash</span>
</span></span><span style="display:flex;"><span>cat ~/.bash_profile   <span style="color:#75715e"># Main configuration file</span>
</span></span><span style="display:flex;"><span>cat ~/.bashrc         <span style="color:#75715e"># Profile configuration file</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Zsh (Mac)</span>
</span></span><span style="display:flex;"><span>cat ~/.zshrc          <span style="color:#75715e"># Main configuration file</span>
</span></span><span style="display:flex;"><span>cat ~/.zprofile       <span style="color:#75715e"># Profile configuration file</span>
</span></span></code></pre></div><p>These files persist aliases or environment variables and your personal scripts, this is really helpful to customize the shell for your taste</p>
<p>✅ Use the Main configuration file for environment variables like JAVA PATH and others.
✅ Use the Profile Configuration File for aliases and other similar settings.</p>
<p>⚠️ Once you add your alias or update the profile configuration, you will need to re-start the terminal for the new configuration to come into effect.</p>
<p>I keep a copy of the profile configuration in git so i have access to my configurations both on my work and other systems if i need em.</p>
<h2 id="common-commandline-tool-that-is-used-often-by-me">Common commandline tool that is used often by me</h2>
<ul>
<li>homebrew - package manager like npm</li>
<li>ddgr - search from the commandline (DuckDuckGo)</li>
<li>ollama - for local offline AI models for simple tasks and quires.</li>
<li>zip/unzip – Compress/uncompress</li>
<li>curl - API testing and others</li>
</ul>
<blockquote>
<p>&ldquo;Warning: Terminal use may cause excessive productivity and happiness.&rdquo; - Ollama 3.5</p>
</blockquote>
]]></content:encoded></item></channel></rss>