<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tools on QuickRef - Personal Developer Reference</title><link>http://qref.eknath.dev/categories/tools/</link><description>Recent content in Tools on QuickRef - Personal Developer Reference</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 08 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="http://qref.eknath.dev/categories/tools/index.xml" rel="self" type="application/rss+xml"/><item><title>CocoaPods</title><link>http://qref.eknath.dev/tools/cocoapods/</link><pubDate>Wed, 08 Apr 2026 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/cocoapods/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. It simplifies the process of integrating third-party libraries (known as &amp;ldquo;pods&amp;rdquo;) into your Xcode projects, handling versioning and transitive dependencies.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;p>CocoaPods is built with Ruby and can be installed using the default Ruby available on macOS.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Install CocoaPods&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo gem install cocoapods
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Install a pre-release version&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo gem install cocoapods --pre
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="basic-workflow">Basic Workflow&lt;/h2>
&lt;h3 id="podfile">Podfile&lt;/h3>
&lt;p>A &lt;code>Podfile&lt;/code> is a specification that describes the dependencies of a project.&lt;/p></description></item><item><title>KiCad</title><link>http://qref.eknath.dev/tools/kicad/</link><pubDate>Wed, 03 Sep 2025 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/kicad/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>KiCad is a cross-platform and open-source Electronic Design Automation (EDA) suite. It includes a schematic editor, a PCB layout tool, a 3D viewer, and a Gerber file viewer. It&amp;rsquo;s a powerful tool for designing and manufacturing printed circuit boards (PCBs).&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Ubuntu/Debian&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo add-apt-repository --yes ppa:kicad/kicad-6.0-releases
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install --install-recommends kicad
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># macOS&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install --cask kicad
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Windows&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download from https://www.kicad.org/download/windows/&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="general-hotkeys">General Hotkeys&lt;/h2>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Hotkey&lt;/th>
 &lt;th>Action&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;code>Ctrl+N&lt;/code>&lt;/td>
 &lt;td>New Project&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Ctrl+O&lt;/code>&lt;/td>
 &lt;td>Open Project&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Ctrl+S&lt;/code>&lt;/td>
 &lt;td>Save File&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Ctrl+Z&lt;/code>&lt;/td>
 &lt;td>Undo&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Ctrl+Y&lt;/code>&lt;/td>
 &lt;td>Redo&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Ctrl+F&lt;/code>&lt;/td>
 &lt;td>Find&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>F1&lt;/code>&lt;/td>
 &lt;td>Help&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Alt+F4&lt;/code>&lt;/td>
 &lt;td>Exit&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 id="schematic-editor-hotkeys">Schematic Editor Hotkeys&lt;/h2>
&lt;h3 id="general">General&lt;/h3>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Hotkey&lt;/th>
 &lt;th>Action&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;code>?&lt;/code>&lt;/td>
 &lt;td>List all hotkeys&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Space&lt;/code>&lt;/td>
 &lt;td>Start placing a component&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>A&lt;/code>&lt;/td>
 &lt;td>Add a symbol&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>W&lt;/code>&lt;/td>
 &lt;td>Wire&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>B&lt;/code>&lt;/td>
 &lt;td>Bus&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>J&lt;/code>&lt;/td>
 &lt;td>Junction&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>L&lt;/code>&lt;/td>
 &lt;td>Label&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>T&lt;/code>&lt;/td>
 &lt;td>Text&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>K&lt;/code>&lt;/td>
 &lt;td>No-Connection Flag&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>V&lt;/code>&lt;/td>
 &lt;td>Value&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>F&lt;/code>&lt;/td>
 &lt;td>Field&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>U&lt;/code>&lt;/td>
 &lt;td>Update PCB from Schematic&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h3 id="component-manipulation">Component Manipulation&lt;/h3>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Hotkey&lt;/th>
 &lt;th>Action&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;code>M&lt;/code>&lt;/td>
 &lt;td>Move&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>R&lt;/code>&lt;/td>
 &lt;td>Rotate&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>G&lt;/code>&lt;/td>
 &lt;td>Drag&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>C&lt;/code>&lt;/td>
 &lt;td>Copy&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Del&lt;/code>&lt;/td>
 &lt;td>Delete&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>E&lt;/code>&lt;/td>
 &lt;td>Edit&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Q&lt;/code>&lt;/td>
 &lt;td>Edit Value&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 id="pcb-editor-hotkeys">PCB Editor Hotkeys&lt;/h2>
&lt;h3 id="general-1">General&lt;/h3>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Hotkey&lt;/th>
 &lt;th>Action&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;code>?&lt;/code>&lt;/td>
 &lt;td>List all hotkeys&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>PageUp&lt;/code>&lt;/td>
 &lt;td>Switch to Top Layer&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>PageDown&lt;/code>&lt;/td>
 &lt;td>Switch to Bottom Layer&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>+&lt;/code>&lt;/td>
 &lt;td>Next Layer&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>-&lt;/code>&lt;/td>
 &lt;td>Previous Layer&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>F5&lt;/code>&lt;/td>
 &lt;td>Switch to Top Layer&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>F6&lt;/code>&lt;/td>
 &lt;td>Switch to Bottom Layer&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>F7&lt;/code>&lt;/td>
 &lt;td>Switch to Inner Layer 1&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>F8&lt;/code>&lt;/td>
 &lt;td>Switch to Inner Layer 2&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Tab&lt;/code>&lt;/td>
 &lt;td>Highlight Net&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>~&lt;/code>&lt;/td>
 &lt;td>Show/Hide Ratsnest&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h3 id="drawing">Drawing&lt;/h3>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Hotkey&lt;/th>
 &lt;th>Action&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;code>X&lt;/code>&lt;/td>
 &lt;td>Route Tracks&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>V&lt;/code>&lt;/td>
 &lt;td>Add Via&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>D&lt;/code>&lt;/td>
 &lt;td>Drag Track&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>G&lt;/code>&lt;/td>
 &lt;td>Drag Item&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Ctrl+M&lt;/code>&lt;/td>
 &lt;td>Move Exactly&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>F&lt;/code>&lt;/td>
 &lt;td>Flip Item to Opposite Side&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Z&lt;/code>&lt;/td>
 &lt;td>Add Filled Zone&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>Ctrl+B&lt;/code>&lt;/td>
 &lt;td>Refill All Zones&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h3 id="3d-viewer">3D Viewer&lt;/h3>
&lt;table>
 &lt;thead>
 &lt;tr>
 &lt;th>Hotkey&lt;/th>
 &lt;th>Action&lt;/th>
 &lt;/tr>
 &lt;/thead>
 &lt;tbody>
 &lt;tr>
 &lt;td>&lt;code>Z&lt;/code>&lt;/td>
 &lt;td>Zoom to Fit&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>R&lt;/code>&lt;/td>
 &lt;td>Reload 3D View&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>O&lt;/code>&lt;/td>
 &lt;td>Orthographic Projection&lt;/td>
 &lt;/tr>
 &lt;tr>
 &lt;td>&lt;code>P&lt;/code>&lt;/td>
 &lt;td>Perspective Projection&lt;/td>
 &lt;/tr>
 &lt;/tbody>
&lt;/table>
&lt;h2 id="tips-and-tricks">Tips and Tricks&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>Use Projects:&lt;/strong> Always start with a project file (&lt;code>.pro&lt;/code>) to keep your schematic and PCB files linked.&lt;/li>
&lt;li>&lt;strong>Libraries:&lt;/strong> KiCad comes with a large library of symbols and footprints. You can also add your own or download them from the internet.&lt;/li>
&lt;li>&lt;strong>Design Rules:&lt;/strong> Set up your design rules in the PCB editor to ensure your board can be manufactured.&lt;/li>
&lt;li>&lt;strong>3D Viewer:&lt;/strong> Use the 3D viewer to check for mechanical conflicts and to get a realistic view of your board.&lt;/li>
&lt;li>&lt;strong>Custom Hotkeys:&lt;/strong> You can customize the hotkeys in the preferences to match your workflow.&lt;/li>
&lt;/ul>
&lt;h2 id="see-also">See Also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://www.kicad.org/">KiCad Website&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.kicad.org/">KiCad Documentation&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://forum.kicad.info/">KiCad Forums&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>ADB (Android Debug Bridge)</title><link>http://qref.eknath.dev/tools/adb/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/adb/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Android Debug Bridge (ADB) is a versatile command-line tool that lets you communicate with a device. The adb command facilitates a variety of device actions, such as installing and debugging apps, and it provides access to a Unix shell that you can use to run a variety of commands on a device.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Ubuntu/Debian&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install adb
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># macOS&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install --cask android-platform-tools
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CentOS/RHEL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo yum install android-tools
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Windows&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download from https://developer.android.com/studio/releases/platform-tools&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="basic-commands">Basic Commands&lt;/h2>
&lt;h3 id="device-management">Device Management&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List connected devices&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb devices
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start the adb server&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb start-server
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Kill the adb server&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb kill-server
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get device state&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb get-state
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Wait for device to be connected&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb wait-for-device
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="file-management">File Management&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push a file to the device&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb push local.txt /sdcard/remote.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pull a file from the device&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb pull /sdcard/remote.txt local.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List files on the device&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell ls /sdcard/
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="app-management">App Management&lt;/h2>
&lt;h3 id="installing-and-uninstalling-apps">Installing and Uninstalling Apps&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Install an APK&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb install app.apk
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Reinstall an existing app, keeping its data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb install -r app.apk
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Uninstall an app&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb uninstall com.example.app
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Uninstall an app, keeping its data and cache&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb uninstall -k com.example.app
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="app-information">App Information&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List all installed packages&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell pm list packages
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List all installed packages with their associated file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell pm list packages -f
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List third-party packages&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell pm list packages -3
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get the path to an APK&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell pm path com.example.app
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="debugging">Debugging&lt;/h2>
&lt;h3 id="logcat">Logcat&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># View logs from the device&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb logcat
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Filter logs by tag&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb logcat -s &lt;span style="color:#a5d6ff">&amp;#34;MyApp&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clear the logcat buffer&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb logcat -c
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="shell-access">Shell Access&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start a remote shell on the device&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Execute a single command on the device&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell &lt;span style="color:#a5d6ff">&amp;#34;ls -l /sdcard/&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="advanced-commands">Advanced Commands&lt;/h2>
&lt;h3 id="port-forwarding">Port Forwarding&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Forward a device port to a local port&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb forward tcp:8080 tcp:8080
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List all forwarded ports&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb forward --list
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="screenshots-and-screen-recording">Screenshots and Screen Recording&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Take a screenshot&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell screencap /sdcard/screenshot.png
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Record the device screen&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell screenrecord /sdcard/demo.mp4
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="quick-reference">Quick Reference&lt;/h2>
&lt;h3 id="common-commands">Common Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>adb devices &lt;span style="color:#8b949e;font-style:italic"># List connected devices&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb shell &lt;span style="color:#8b949e;font-style:italic"># Enter a remote shell&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb push &amp;lt;local&amp;gt; &amp;lt;remote&amp;gt; &lt;span style="color:#8b949e;font-style:italic"># Push a file to the device&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb pull &amp;lt;remote&amp;gt; &amp;lt;local&amp;gt; &lt;span style="color:#8b949e;font-style:italic"># Pull a file from the device&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb install &amp;lt;apk&amp;gt; &lt;span style="color:#8b949e;font-style:italic"># Install an app&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb uninstall &amp;lt;package&amp;gt; &lt;span style="color:#8b949e;font-style:italic"># Uninstall an app&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>adb logcat &lt;span style="color:#8b949e;font-style:italic"># View device logs&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="see-also">See Also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://developer.android.com/studio/command-line/adb">Official ADB Documentation&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://developer.android.com/">Android Developer Documentation&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Curl</title><link>http://qref.eknath.dev/tools/curl/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/curl/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Curl is a command-line tool for transferring data from or to servers using various protocols including HTTP, HTTPS, FTP, and more. It&amp;rsquo;s essential for API testing, web scraping, downloading files, and debugging network requests.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Ubuntu/Debian&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install curl
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># macOS (usually pre-installed)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install curl
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CentOS/RHEL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo yum install curl
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Windows&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download from https://curl.se/windows/&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="basic-usage">Basic Usage&lt;/h2>
&lt;h3 id="simple-get-request">Simple GET Request&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Basic GET request&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># GET with verbose output&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -v https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># GET with headers only&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -I https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="download-files">Download Files&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -O https://example.com/file.zip
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download with custom filename&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -o myfile.zip https://example.com/file.zip
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download multiple files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -O https://example.com/file1.zip -O https://example.com/file2.zip
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="http-methods">HTTP Methods&lt;/h2>
&lt;h3 id="get-requests">GET Requests&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Simple GET&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl https://api.example.com/users
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># GET with query parameters&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl &lt;span style="color:#a5d6ff">&amp;#34;https://api.example.com/users?page=1&amp;amp;limit=10&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># GET with URL encoding&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -G -d &lt;span style="color:#a5d6ff">&amp;#34;q=search term&amp;#34;&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#34;page=1&amp;#34;&lt;/span> https://api.example.com/search
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="post-requests">POST Requests&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># POST with data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST -d &lt;span style="color:#a5d6ff">&amp;#34;name=John&amp;amp;email=john@example.com&amp;#34;&lt;/span> https://api.example.com/users
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># POST with JSON data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;email&amp;#34;:&amp;#34;john@example.com&amp;#34;}&amp;#39;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/users
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># POST with file data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d @data.json &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/users
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="put-requests">PUT Requests&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># PUT request&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X PUT &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John Updated&amp;#34;}&amp;#39;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/users/123
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="delete-requests">DELETE Requests&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># DELETE request&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X DELETE https://api.example.com/users/123
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># DELETE with authentication&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X DELETE &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: Bearer token123&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/users/123
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="patch-requests">PATCH Requests&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># PATCH request&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X PATCH &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;Partially Updated&amp;#34;}&amp;#39;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/users/123
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="headers-and-authentication">Headers and Authentication&lt;/h2>
&lt;h3 id="custom-headers">Custom Headers&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add custom header&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: Bearer token123&amp;#34;&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Multiple headers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: Bearer token123&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;User-Agent: MyApp/1.0&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Remove default headers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -H &lt;span style="color:#a5d6ff">&amp;#34;User-Agent:&amp;#34;&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="authentication">Authentication&lt;/h3>
&lt;h4 id="basic-authentication">Basic Authentication&lt;/h4>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Basic auth with username:password&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -u username:password https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Basic auth with prompt for password&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -u username https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Basic auth with encoded credentials&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: Basic dXNlcjpwYXNz&amp;#34;&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="bearer-token">Bearer Token&lt;/h4>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Bearer token&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: Bearer your-token-here&amp;#34;&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># OAuth token&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: OAuth oauth-token&amp;#34;&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h4 id="api-key">API Key&lt;/h4>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># API key in header&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -H &lt;span style="color:#a5d6ff">&amp;#34;X-API-Key: your-api-key&amp;#34;&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># API key in query parameter&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl &lt;span style="color:#a5d6ff">&amp;#34;https://api.example.com/data?api_key=your-api-key&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="data-formats">Data Formats&lt;/h2>
&lt;h3 id="json-data">JSON Data&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># JSON POST&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;key&amp;#34;:&amp;#34;value&amp;#34;,&amp;#34;number&amp;#34;:42}&amp;#39;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># JSON from file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d @data.json &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="form-data">Form Data&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># URL-encoded form data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/x-www-form-urlencoded&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#34;name=John&amp;amp;email=john@example.com&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Form data (automatic content-type)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#34;name=John&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#34;email=john@example.com&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="multipart-form-data">Multipart Form Data&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># File upload&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -F &lt;span style="color:#a5d6ff">&amp;#34;file=@document.pdf&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/upload
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Mixed form data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -F &lt;span style="color:#a5d6ff">&amp;#34;name=John&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -F &lt;span style="color:#a5d6ff">&amp;#34;email=john@example.com&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -F &lt;span style="color:#a5d6ff">&amp;#34;avatar=@profile.jpg&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/users
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="xml-data">XML Data&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># XML POST&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/xml&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#39;&amp;lt;user&amp;gt;&amp;lt;name&amp;gt;John&amp;lt;/name&amp;gt;&amp;lt;email&amp;gt;john@example.com&amp;lt;/email&amp;gt;&amp;lt;/user&amp;gt;&amp;#39;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="output-and-formatting">Output and Formatting&lt;/h2>
&lt;h3 id="output-control">Output Control&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Save response to file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -o response.json https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Append to file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -o response.json https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Silent mode (no progress bar)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show only HTTP status code&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s -o /dev/null -w &lt;span style="color:#a5d6ff">&amp;#34;%{http_code}&amp;#34;&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="response-information">Response Information&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show response headers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -i https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show only headers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -I https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Verbose output&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -v https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show response time&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -w &lt;span style="color:#a5d6ff">&amp;#34;%{time_total}\n&amp;#34;&lt;/span> -o /dev/null -s https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="pretty-print-json">Pretty Print JSON&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Format JSON output (with jq)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://api.example.com | jq &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Format JSON with Python&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://api.example.com | python -m json.tool
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Save formatted JSON&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://api.example.com | jq &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span> &amp;gt; formatted.json
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="advanced-features">Advanced Features&lt;/h2>
&lt;h3 id="follow-redirects">Follow Redirects&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Follow redirects&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -L https://example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Follow redirects with max count&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -L --max-redirs &lt;span style="color:#a5d6ff">5&lt;/span> https://example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show redirect chain&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -L -v https://example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="cookies">Cookies&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Save cookies&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -c cookies.txt https://example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Load cookies&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -b cookies.txt https://example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use specific cookie&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -H &lt;span style="color:#a5d6ff">&amp;#34;Cookie: sessionid=abc123&amp;#34;&lt;/span> https://example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="timeouts-and-retries">Timeouts and Retries&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Connection timeout&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --connect-timeout &lt;span style="color:#a5d6ff">10&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Maximum time for request&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --max-time &lt;span style="color:#a5d6ff">30&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Retry on failure&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --retry &lt;span style="color:#a5d6ff">3&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Retry with delay&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --retry &lt;span style="color:#a5d6ff">3&lt;/span> --retry-delay &lt;span style="color:#a5d6ff">2&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="proxy-support">Proxy Support&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use HTTP proxy&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --proxy http://proxy.example.com:8080 https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use SOCKS proxy&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --socks5 proxy.example.com:1080 https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Proxy authentication&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --proxy-user username:password &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> --proxy http://proxy.example.com:8080 &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="ssltls-options">SSL/TLS Options&lt;/h2>
&lt;h3 id="ssl-verification">SSL Verification&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Skip SSL verification (insecure)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -k https://self-signed.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use specific CA certificate&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --cacert ca-cert.pem https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use client certificate&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --cert client-cert.pem --key client-key.pem https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="ssl-information">SSL Information&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show SSL certificate info&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -v https://api.example.com 2&amp;gt;&amp;amp;&lt;span style="color:#a5d6ff">1&lt;/span> | grep -A &lt;span style="color:#a5d6ff">10&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;Server certificate&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check SSL certificate expiration&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -v https://api.example.com 2&amp;gt;&amp;amp;&lt;span style="color:#a5d6ff">1&lt;/span> | grep &lt;span style="color:#a5d6ff">&amp;#34;expire date&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="testing-apis">Testing APIs&lt;/h2>
&lt;h3 id="rest-api-testing">REST API Testing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Test API endpoint&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X GET &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Accept: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/v1/users
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Test with authentication&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X GET &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: Bearer token123&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Accept: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/v1/users/me
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Test error handling&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X GET &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Accept: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/v1/nonexistent
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="graphql-api-testing">GraphQL API Testing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># GraphQL query&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;query&amp;#34;:&amp;#34;query { users { id name email } }&amp;#34;}&amp;#39;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/graphql
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># GraphQL mutation&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;query&amp;#34;:&amp;#34;mutation { createUser(name: \&amp;#34;John\&amp;#34;, email: \&amp;#34;john@example.com\&amp;#34;) { id name } }&amp;#34;}&amp;#39;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> https://api.example.com/graphql
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="health-checks">Health Checks&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Simple health check&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -f https://api.example.com/health
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Health check with timeout&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -f --max-time &lt;span style="color:#a5d6ff">5&lt;/span> https://api.example.com/health
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Health check script&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">#!/bin/bash&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">if&lt;/span> curl -f -s https://api.example.com/health &amp;gt; /dev/null; &lt;span style="color:#ff7b72">then&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> echo &lt;span style="color:#a5d6ff">&amp;#34;Service is healthy&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">else&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> echo &lt;span style="color:#a5d6ff">&amp;#34;Service is down&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">fi&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="practical-examples">Practical Examples&lt;/h2>
&lt;h3 id="download-and-extract">Download and Extract&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download and extract tar.gz&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -L https://example.com/file.tar.gz | tar -xz
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download and pipe to command&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://api.example.com/data | jq &lt;span style="color:#a5d6ff">&amp;#39;.results[]&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="api-testing-script">API Testing Script&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-weight:bold;font-style:italic">#!/bin/bash
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-weight:bold;font-style:italic">&lt;/span>&lt;span style="color:#79c0ff">API_BASE&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;https://api.example.com&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">TOKEN&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;your-token-here&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Test authentication&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#34;Testing authentication...&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: Bearer &lt;/span>&lt;span style="color:#79c0ff">$TOKEN&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>&lt;span style="color:#79c0ff">$API_BASE&lt;/span>&lt;span style="color:#a5d6ff">/auth/test&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Test GET endpoint&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#34;Testing GET endpoint...&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: Bearer &lt;/span>&lt;span style="color:#79c0ff">$TOKEN&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>&lt;span style="color:#79c0ff">$API_BASE&lt;/span>&lt;span style="color:#a5d6ff">/users&amp;#34;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Test POST endpoint&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#34;Testing POST endpoint...&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s -X POST &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Authorization: Bearer &lt;/span>&lt;span style="color:#79c0ff">$TOKEN&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -H &lt;span style="color:#a5d6ff">&amp;#34;Content-Type: application/json&amp;#34;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> -d &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;Test User&amp;#34;,&amp;#34;email&amp;#34;:&amp;#34;test@example.com&amp;#34;}&amp;#39;&lt;/span> &lt;span style="color:#79c0ff">\
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>&lt;span style="color:#79c0ff">$API_BASE&lt;/span>&lt;span style="color:#a5d6ff">/users&amp;#34;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="web-scraping">Web Scraping&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download webpage&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://example.com | grep -o &lt;span style="color:#a5d6ff">&amp;#39;&amp;lt;title&amp;gt;.*&amp;lt;/title&amp;gt;&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download images from webpage&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://example.com | grep -o &lt;span style="color:#a5d6ff">&amp;#39;src=&amp;#34;[^&amp;#34;]*\.jpg&amp;#34;&amp;#39;&lt;/span> | cut -d&lt;span style="color:#a5d6ff">&amp;#39;&amp;#34;&amp;#39;&lt;/span> -f2 | xargs -I &lt;span style="color:#ff7b72;font-weight:bold">{}&lt;/span> curl -O &lt;span style="color:#ff7b72;font-weight:bold">{}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check HTTP status codes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s -o /dev/null -w &lt;span style="color:#a5d6ff">&amp;#34;%{http_code} %{url_effective}\n&amp;#34;&lt;/span> https://example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="error-handling">Error Handling&lt;/h2>
&lt;h3 id="common-http-status-codes">Common HTTP Status Codes&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check for specific status codes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s -o /dev/null -w &lt;span style="color:#a5d6ff">&amp;#34;%{http_code}&amp;#34;&lt;/span> https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># 200 - OK&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># 401 - Unauthorized&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># 404 - Not Found&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># 500 - Server Error&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="error-handling-in-scripts">Error Handling in Scripts&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-weight:bold;font-style:italic">#!/bin/bash
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-weight:bold;font-style:italic">&lt;/span>&lt;span style="color:#79c0ff">response&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#ff7b72">$(&lt;/span>curl -s -w &lt;span style="color:#a5d6ff">&amp;#34;%{http_code}&amp;#34;&lt;/span> https://api.example.com&lt;span style="color:#ff7b72">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">status_code&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>&lt;span style="color:#a5d6ff">${&lt;/span>&lt;span style="color:#79c0ff">response&lt;/span>: -3&lt;span style="color:#a5d6ff">}&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">body&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>&lt;span style="color:#a5d6ff">${&lt;/span>&lt;span style="color:#79c0ff">response&lt;/span>%???&lt;span style="color:#a5d6ff">}&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">if&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>&lt;span style="color:#79c0ff">$status_code&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span> -eq &lt;span style="color:#a5d6ff">200&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span>; &lt;span style="color:#ff7b72">then&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> echo &lt;span style="color:#a5d6ff">&amp;#34;Success: &lt;/span>&lt;span style="color:#79c0ff">$body&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">else&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> echo &lt;span style="color:#a5d6ff">&amp;#34;Error: HTTP &lt;/span>&lt;span style="color:#79c0ff">$status_code&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> echo &lt;span style="color:#a5d6ff">&amp;#34;Response: &lt;/span>&lt;span style="color:#79c0ff">$body&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">fi&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="configuration">Configuration&lt;/h2>
&lt;h3 id="config-file-curlrc">Config File (~/.curlrc)&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Default options&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>user-agent &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;MyApp/1.0&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>connect-timeout &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">10&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>max-time &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">30&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">retry&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#a5d6ff">3&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>silent
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>show-error
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="environment-variables">Environment Variables&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Set proxy&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export &lt;span style="color:#79c0ff">HTTP_PROXY&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>http://proxy.example.com:8080
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export &lt;span style="color:#79c0ff">HTTPS_PROXY&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>http://proxy.example.com:8080
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Set CA certificate path&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export &lt;span style="color:#79c0ff">CURL_CA_BUNDLE&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>/path/to/ca-bundle.crt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="quick-reference">Quick Reference&lt;/h2>
&lt;h3 id="common-options">Common Options&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>-X, --request &lt;span style="color:#8b949e;font-style:italic"># HTTP method&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-H, --header &lt;span style="color:#8b949e;font-style:italic"># Add header&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-d, --data &lt;span style="color:#8b949e;font-style:italic"># POST data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-F, --form &lt;span style="color:#8b949e;font-style:italic"># Form data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-o, --output &lt;span style="color:#8b949e;font-style:italic"># Output file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-O, --remote-name &lt;span style="color:#8b949e;font-style:italic"># Use remote filename&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-u, --user &lt;span style="color:#8b949e;font-style:italic"># Authentication&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-v, --verbose &lt;span style="color:#8b949e;font-style:italic"># Verbose output&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-s, --silent &lt;span style="color:#8b949e;font-style:italic"># Silent mode&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-I, --head &lt;span style="color:#8b949e;font-style:italic"># Headers only&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-L, --location &lt;span style="color:#8b949e;font-style:italic"># Follow redirects&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>-k, --insecure &lt;span style="color:#8b949e;font-style:italic"># Skip SSL verification&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="format-strings">Format Strings&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>%&lt;span style="color:#ff7b72;font-weight:bold">{&lt;/span>http_code&lt;span style="color:#ff7b72;font-weight:bold">}&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># HTTP status code&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>%&lt;span style="color:#ff7b72;font-weight:bold">{&lt;/span>time_total&lt;span style="color:#ff7b72;font-weight:bold">}&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Total time&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>%&lt;span style="color:#ff7b72;font-weight:bold">{&lt;/span>time_connect&lt;span style="color:#ff7b72;font-weight:bold">}&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Connection time&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>%&lt;span style="color:#ff7b72;font-weight:bold">{&lt;/span>size_download&lt;span style="color:#ff7b72;font-weight:bold">}&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Download size&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>%&lt;span style="color:#ff7b72;font-weight:bold">{&lt;/span>speed_download&lt;span style="color:#ff7b72;font-weight:bold">}&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Download speed&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>%&lt;span style="color:#ff7b72;font-weight:bold">{&lt;/span>url_effective&lt;span style="color:#ff7b72;font-weight:bold">}&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Final URL&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="tips-and-tricks">Tips and Tricks&lt;/h2>
&lt;h3 id="performance-testing">Performance Testing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Measure response time&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -w &lt;span style="color:#a5d6ff">&amp;#34;@curl-format.txt&amp;#34;&lt;/span> -o /dev/null -s https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># curl-format.txt content:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># time_namelookup: %{time_namelookup}\n&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># time_connect: %{time_connect}\n&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># time_appconnect: %{time_appconnect}\n&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># time_pretransfer: %{time_pretransfer}\n&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># time_redirect: %{time_redirect}\n&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># time_starttransfer: %{time_starttransfer}\n&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># ----------\n&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># time_total: %{time_total}\n&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="debugging">Debugging&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Debug with verbose output&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -v https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Debug with trace&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl --trace-ascii debug.txt https://api.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Debug SSL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -v --trace-ascii ssl-debug.txt https://api.example.com
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="see-also">See Also&lt;/h2>
&lt;ul>
&lt;li>&lt;code>man curl&lt;/code> - Complete manual&lt;/li>
&lt;li>&lt;code>curl --help&lt;/code> - Quick help&lt;/li>
&lt;li>&lt;a href="https://curl.se/docs/">curl documentation&lt;/a> - Official docs&lt;/li>
&lt;li>&lt;code>wget&lt;/code> - Alternative download tool&lt;/li>
&lt;li>&lt;code>httpie&lt;/code> - Modern HTTP client&lt;/li>
&lt;li>&lt;code>jq&lt;/code> - JSON processor for formatting responses&lt;/li>
&lt;/ul></description></item><item><title>Docker</title><link>http://qref.eknath.dev/tools/docker/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/docker/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Docker is a platform that enables developers to package applications and their dependencies into lightweight, portable containers. It provides consistent environments across development, testing, and production, making application deployment more reliable and scalable.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Ubuntu/Debian&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -fsSL https://get.docker.com -o get-docker.sh
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo sh get-docker.sh
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo usermod -aG docker &lt;span style="color:#79c0ff">$USER&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># macOS&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install docker &lt;span style="color:#8b949e;font-style:italic"># OpenSource &amp;amp; recommended&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install --cask docker &lt;span style="color:#8b949e;font-style:italic"># NOT OPEN SOURCE&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># or download Docker Desktop from https://docker.com&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CentOS/RHEL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo yum install -y yum-utils
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo yum install docker-ce docker-ce-cli containerd.io
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start Docker service&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo systemctl start docker
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo systemctl enable docker
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="my-way-of-installation-on-mac">My way of installation on mac&lt;/h2>
&lt;p>I prefer to use the open source version of the docker, hence these are the steps i had to take to download and install the docker on my device.&lt;/p></description></item><item><title>Git</title><link>http://qref.eknath.dev/tools/git/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/git/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Git is a distributed version control system that tracks changes in files and coordinates work among multiple developers. It&amp;rsquo;s essential for software development, enabling collaboration, version tracking, and code management.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Ubuntu/Debian&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># macOS&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># or use Xcode Command Line Tools&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>xcode-select --install
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CentOS/RHEL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo yum install git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Windows&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download from https://git-scm.com/download/win&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="initial-setup">Initial Setup&lt;/h2>
&lt;h3 id="configuration">Configuration&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Set global username and email&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global user.name &lt;span style="color:#a5d6ff">&amp;#34;Your Name&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global user.email &lt;span style="color:#a5d6ff">&amp;#34;your.email@example.com&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Set default editor&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global core.editor &lt;span style="color:#a5d6ff">&amp;#34;vim&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Set default branch name&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global init.defaultBranch main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List all configurations&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --list
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="ssh-key-setup">SSH Key Setup&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Generate SSH key&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssh-keygen -t ed25519 -C &lt;span style="color:#a5d6ff">&amp;#34;your.email@example.com&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start SSH agent&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>eval &lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>&lt;span style="color:#ff7b72">$(&lt;/span>ssh-agent -s&lt;span style="color:#ff7b72">)&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add key to agent&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssh-add ~/.ssh/id_ed25519
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Copy public key to clipboard&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat ~/.ssh/id_ed25519.pub
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add to GitHub/GitLab/etc.&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="repository-basics">Repository Basics&lt;/h2>
&lt;h3 id="creating-repositories">Creating Repositories&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Initialize new repository&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git init
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Initialize with specific branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git init -b main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clone existing repository&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git clone https://github.com/user/repo.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clone with specific name&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git clone https://github.com/user/repo.git my-project
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clone specific branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git clone -b branch-name https://github.com/user/repo.git
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="repository-status">Repository Status&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check status&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git status
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Short status&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git status -s
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show branch information&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -v
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show remote information&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git remote -v
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="basic-workflow">Basic Workflow&lt;/h2>
&lt;h3 id="staging-changes">Staging Changes&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add specific file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add filename.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add all files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add all files in directory&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add src/
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add by pattern&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add &lt;span style="color:#a5d6ff">&amp;#34;*.js&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Interactive staging&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add -i
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add patches interactively&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add -p
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="committing-changes">Committing Changes&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Commit with message&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit -m &lt;span style="color:#a5d6ff">&amp;#34;Add new feature&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Commit with detailed message&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit -m &lt;span style="color:#a5d6ff">&amp;#34;Add user authentication&amp;#34;&lt;/span> -m &lt;span style="color:#a5d6ff">&amp;#34;Detailed description here&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Commit all tracked changes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit -a -m &lt;span style="color:#a5d6ff">&amp;#34;Update existing files&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Amend last commit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit --amend -m &lt;span style="color:#a5d6ff">&amp;#34;Updated commit message&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Commit with specific author&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit --author&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;Name &amp;lt;email@example.com&amp;gt;&amp;#34;&lt;/span> -m &lt;span style="color:#a5d6ff">&amp;#34;Message&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="viewing-history">Viewing History&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show commit history&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show concise history&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log --oneline
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show graph&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log --graph --oneline --all
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show specific number of commits&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log -n &lt;span style="color:#a5d6ff">5&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show commits by author&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log --author&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;John Doe&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show commits since date&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log --since&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;2 weeks ago&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show file changes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log --stat
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="branching">Branching&lt;/h2>
&lt;h3 id="creating-branches">Creating Branches&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create new branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create and switch to branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout -b feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create branch from specific commit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout -b hotfix abc1234
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create branch from remote&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout -b local-branch origin/remote-branch
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="switching-branches">Switching Branches&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Switch to branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout branch-name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Switch to previous branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout -
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Switch using newer syntax&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git switch branch-name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create and switch (newer syntax)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git switch -c new-branch
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="managing-branches">Managing Branches&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List branches&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List all branches (including remote)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -a
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List remote branches&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -r
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Delete branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -d branch-name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Force delete branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -D branch-name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Rename branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -m old-name new-name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Rename current branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -m new-name
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="remote-repositories">Remote Repositories&lt;/h2>
&lt;h3 id="adding-remotes">Adding Remotes&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add remote&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git remote add origin https://github.com/user/repo.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add multiple remotes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git remote add upstream https://github.com/original/repo.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Change remote URL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git remote set-url origin https://github.com/user/new-repo.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Remove remote&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git remote remove origin
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="fetching-and-pulling">Fetching and Pulling&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Fetch from remote&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git fetch origin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Fetch all remotes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git fetch --all
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pull (fetch + merge)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git pull origin main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pull with rebase&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git pull --rebase origin main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pull specific branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git pull origin feature-branch
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="pushing-changes">Pushing Changes&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push to remote&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push origin main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push new branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push -u origin feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push all branches&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push --all origin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push tags&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push --tags origin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Force push (dangerous)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push --force origin main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Force push with lease (safer)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push --force-with-lease origin main
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="merging-and-rebasing">Merging and Rebasing&lt;/h2>
&lt;h3 id="merging">Merging&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Merge branch into current&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git merge feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Merge with no fast-forward&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git merge --no-ff feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Merge with squash&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git merge --squash feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Abort merge&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git merge --abort
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Continue merge after resolving conflicts&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git merge --continue
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="rebasing">Rebasing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Rebase current branch onto main&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git rebase main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Interactive rebase&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git rebase -i HEAD~3
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Rebase onto specific commit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git rebase --onto main feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Abort rebase&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git rebase --abort
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Continue rebase after resolving conflicts&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git rebase --continue
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Skip current commit during rebase&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git rebase --skip
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="resolving-conflicts">Resolving Conflicts&lt;/h2>
&lt;h3 id="conflict-resolution">Conflict Resolution&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show conflicts&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git status
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># View conflicted file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat conflicted-file.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Resolve conflicts manually, then:&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add conflicted-file.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use merge tool&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git mergetool
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Abort merge/rebase&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git merge --abort
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git rebase --abort
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="conflict-prevention">Conflict Prevention&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check for conflicts before merging&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git merge --no-commit --no-ff feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Fetch and check differences&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git fetch origin
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git diff HEAD origin/main
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="undoing-changes">Undoing Changes&lt;/h2>
&lt;h3 id="working-directory">Working Directory&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Discard changes in file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout -- filename.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Discard all changes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Restore file (newer syntax)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git restore filename.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Restore all files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git restore .
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="staging-area">Staging Area&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Unstage file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git reset filename.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Unstage all files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git reset
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Unstage with newer syntax&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git restore --staged filename.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="commits">Commits&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Undo last commit (keep changes)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git reset --soft HEAD~1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Undo last commit (discard changes)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git reset --hard HEAD~1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Undo specific commit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git revert abc1234
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Reset to specific commit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git reset --hard abc1234
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create new commit that undoes changes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git revert HEAD
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="stashing">Stashing&lt;/h2>
&lt;h3 id="basic-stashing">Basic Stashing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Stash changes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Stash with message&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash save &lt;span style="color:#a5d6ff">&amp;#34;Work in progress&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Stash including untracked files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash -u
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Stash specific files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash push -m &lt;span style="color:#a5d6ff">&amp;#34;message&amp;#34;&lt;/span> filename.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="managing-stashes">Managing Stashes&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List stashes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash list
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show stash contents&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash show
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Apply latest stash&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash apply
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Apply specific stash&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash apply stash@&lt;span style="color:#ff7b72;font-weight:bold">{&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pop stash (apply and remove)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash pop
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Drop stash&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash drop stash@&lt;span style="color:#ff7b72;font-weight:bold">{&lt;/span>1&lt;span style="color:#ff7b72;font-weight:bold">}&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clear all stashes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git stash clear
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="tags">Tags&lt;/h2>
&lt;h3 id="creating-tags">Creating Tags&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create lightweight tag&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git tag v1.0.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create annotated tag&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git tag -a v1.0.0 -m &lt;span style="color:#a5d6ff">&amp;#34;Version 1.0.0&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Tag specific commit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git tag -a v1.0.0 abc1234 -m &lt;span style="color:#a5d6ff">&amp;#34;Version 1.0.0&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List tags&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git tag
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List tags with pattern&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git tag -l &lt;span style="color:#a5d6ff">&amp;#34;v1.*&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="managing-tags">Managing Tags&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show tag information&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git show v1.0.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Delete tag&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git tag -d v1.0.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Delete remote tag&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push origin :refs/tags/v1.0.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push tags&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push origin --tags
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push specific tag&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push origin v1.0.0
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="advanced-features">Advanced Features&lt;/h2>
&lt;h3 id="searching">Searching&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Search in files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git grep &lt;span style="color:#a5d6ff">&amp;#34;search term&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Search in specific files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git grep &lt;span style="color:#a5d6ff">&amp;#34;search term&amp;#34;&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;*.js&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Search in commit messages&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log --grep&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;fix bug&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Search in commit content&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log -S &lt;span style="color:#a5d6ff">&amp;#34;function name&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show commits that added/removed line&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log -p -S &lt;span style="color:#a5d6ff">&amp;#34;search term&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="blame-and-history">Blame and History&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show file annotations&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git blame filename.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show file history&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log --follow filename.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show who changed lines&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git blame -L 10,20 filename.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show changes in specific commit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git show abc1234
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show changes between commits&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git diff abc1234..def5678
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="submodules">Submodules&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add submodule&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git submodule add https://github.com/user/repo.git libs/repo
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Initialize submodules&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git submodule init
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Update submodules&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git submodule update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clone with submodules&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git clone --recursive https://github.com/user/repo.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Update submodules to latest&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git submodule update --remote
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="configuration-1">Configuration&lt;/h2>
&lt;h3 id="global-config">Global Config&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Common settings&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global core.autocrlf input
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global core.safecrlf true
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global push.default simple
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global pull.rebase true
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global rerere.enabled true
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="aliases">Aliases&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Common aliases&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.co checkout
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.br branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.ci commit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.st status
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.unstage &lt;span style="color:#a5d6ff">&amp;#39;reset HEAD --&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.last &lt;span style="color:#a5d6ff">&amp;#39;log -1 HEAD&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.visual &lt;span style="color:#a5d6ff">&amp;#39;!gitk&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.lg &lt;span style="color:#a5d6ff">&amp;#39;log --graph --pretty=format:&amp;#34;%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)&amp;lt;%an&amp;gt;%Creset&amp;#34; --abbrev-commit&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="ignore-files">Ignore Files&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create .gitignore file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#34;node_modules/&amp;#34;&lt;/span> &amp;gt;&amp;gt; .gitignore
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#34;*.log&amp;#34;&lt;/span> &amp;gt;&amp;gt; .gitignore
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#34;.env&amp;#34;&lt;/span> &amp;gt;&amp;gt; .gitignore
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Global gitignore&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global core.excludesfile ~/.gitignore_global
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="git-workflows">Git Workflows&lt;/h2>
&lt;h3 id="feature-branch-workflow">Feature Branch Workflow&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create feature branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout -b feature/new-feature
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Work on feature&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit -m &lt;span style="color:#a5d6ff">&amp;#34;Add new feature&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push feature branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push -u origin feature/new-feature
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create pull request (on GitHub/GitLab)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># After approval, merge and cleanup&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git pull origin main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -d feature/new-feature
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="gitflow-workflow">Gitflow Workflow&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Initialize gitflow&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git flow init
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start feature&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git flow feature start new-feature
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Finish feature&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git flow feature finish new-feature
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start release&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git flow release start 1.0.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Finish release&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git flow release finish 1.0.0
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start hotfix&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git flow hotfix start critical-fix
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Finish hotfix&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git flow hotfix finish critical-fix
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="github-flow">GitHub Flow&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create branch from main&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git pull origin main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout -b feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Make changes and commit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit -m &lt;span style="color:#a5d6ff">&amp;#34;Implement feature&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push and create PR&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push -u origin feature-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># After PR merge, cleanup&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git pull origin main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -d feature-branch
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="troubleshooting">Troubleshooting&lt;/h2>
&lt;h3 id="common-issues">Common Issues&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Fix &amp;#34;detached HEAD&amp;#34; state&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Recover deleted branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git reflog
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout -b recovered-branch abc1234
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Fix merge conflicts&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git status
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Edit conflicted files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Undo accidental commit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git reset --soft HEAD~1
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clean untracked files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git clean -fd
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Fix line endings&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config core.autocrlf true
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git rm --cached -r .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git reset --hard
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="recovery">Recovery&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show reflog&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git reflog
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Recover lost commits&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git cherry-pick abc1234
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Recover deleted branch&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch recovered-branch abc1234
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Find lost commits&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git fsck --lost-found
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Garbage collection&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git gc --prune&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>now
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="best-practices">Best Practices&lt;/h2>
&lt;h3 id="commit-messages">Commit Messages&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Good commit message format&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit -m &lt;span style="color:#a5d6ff">&amp;#34;Add user authentication feature
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">- Implement login/logout functionality
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">- Add password hashing
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">- Create user session management
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">- Add input validation
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">Closes #123&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="branch-naming">Branch Naming&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Good branch names&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>feature/user-authentication
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bugfix/login-error
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>hotfix/security-patch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>release/v1.2.0
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="repository-hygiene">Repository Hygiene&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Regular maintenance&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git fetch --prune
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -d merged-branch
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git tag -d old-tag
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git gc --aggressive
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="quick-reference">Quick Reference&lt;/h2>
&lt;h3 id="essential-commands">Essential Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Repository setup&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git init
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git clone &amp;lt;url&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git remote add origin &amp;lt;url&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Basic workflow&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git add .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git commit -m &lt;span style="color:#a5d6ff">&amp;#34;message&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git push origin main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git pull origin main
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Branching&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch feature
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git checkout feature
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git merge feature
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git branch -d feature
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Status and history&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git status
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git log --oneline
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git diff
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="useful-aliases">Useful Aliases&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>git config --global alias.s status
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.a &lt;span style="color:#a5d6ff">&amp;#39;add .&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.c &lt;span style="color:#a5d6ff">&amp;#39;commit -m&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.p &lt;span style="color:#a5d6ff">&amp;#39;push origin HEAD&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.l &lt;span style="color:#a5d6ff">&amp;#39;log --oneline&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.co checkout
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git config --global alias.br branch
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="see-also">See Also&lt;/h2>
&lt;ul>
&lt;li>&lt;code>man git&lt;/code> - Complete manual&lt;/li>
&lt;li>&lt;code>git help &amp;lt;command&amp;gt;&lt;/code> - Help for specific command&lt;/li>
&lt;li>&lt;a href="https://git-scm.com/doc">Git Documentation&lt;/a> - Official documentation&lt;/li>
&lt;li>&lt;a href="https://git-scm.com/book">Pro Git Book&lt;/a> - Comprehensive guide&lt;/li>
&lt;li>&lt;a href="https://docs.github.com/">GitHub Docs&lt;/a> - GitHub-specific features&lt;/li>
&lt;li>&lt;a href="https://docs.gitlab.com/">GitLab Docs&lt;/a> - GitLab-specific features&lt;/li>
&lt;/ul></description></item><item><title>Grep</title><link>http://qref.eknath.dev/tools/grep/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/grep/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Grep is a command-line utility for searching plain-text data sets for lines that match a regular expression. It&amp;rsquo;s one of the most powerful and frequently used tools in Unix/Linux systems.&lt;/p>
&lt;h2 id="basic-usage">Basic Usage&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> filename
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>Example:&lt;/strong>&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Search for the word &amp;#34;error&amp;#34; in log file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grep &lt;span style="color:#a5d6ff">&amp;#34;error&amp;#34;&lt;/span> /var/log/system.log
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="common-options">Common Options&lt;/h2>
&lt;h3 id="case--matching">Case &amp;amp; Matching&lt;/h3>
&lt;ul>
&lt;li>&lt;code>-i&lt;/code> - Ignore case&lt;/li>
&lt;li>&lt;code>-v&lt;/code> - Invert match (exclude)&lt;/li>
&lt;li>&lt;code>-w&lt;/code> - Match whole words&lt;/li>
&lt;li>&lt;code>-x&lt;/code> - Match whole lines&lt;/li>
&lt;li>&lt;code>-F&lt;/code> - Fixed strings (no regex)&lt;/li>
&lt;li>&lt;code>-E&lt;/code> - Extended regex&lt;/li>
&lt;/ul>
&lt;h3 id="output-control">Output Control&lt;/h3>
&lt;ul>
&lt;li>&lt;code>-n&lt;/code> - Show line numbers&lt;/li>
&lt;li>&lt;code>-c&lt;/code> - Count matches&lt;/li>
&lt;li>&lt;code>-l&lt;/code> - List matching files&lt;/li>
&lt;li>&lt;code>-L&lt;/code> - List non-matching files&lt;/li>
&lt;li>&lt;code>-o&lt;/code> - Show only matches&lt;/li>
&lt;li>&lt;code>-q&lt;/code> - Quiet mode&lt;/li>
&lt;/ul>
&lt;h2 id="context-options">Context Options&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show 3 lines after match&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grep -A &lt;span style="color:#a5d6ff">3&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> file
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show 3 lines before match&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grep -B &lt;span style="color:#a5d6ff">3&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> file
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show 3 lines around match&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grep -C &lt;span style="color:#a5d6ff">3&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> file
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="regular-expressions">Regular Expressions&lt;/h2>
&lt;h3 id="basic-patterns">Basic Patterns&lt;/h3>
&lt;ul>
&lt;li>&lt;code>^&lt;/code> - Start of line&lt;/li>
&lt;li>&lt;code>$&lt;/code> - End of line&lt;/li>
&lt;li>&lt;code>.&lt;/code> - Any character&lt;/li>
&lt;li>&lt;code>*&lt;/code> - Zero or more&lt;/li>
&lt;li>&lt;code>+&lt;/code> - One or more (with -E)&lt;/li>
&lt;li>&lt;code>?&lt;/code> - Zero or one (with -E)&lt;/li>
&lt;/ul>
&lt;h3 id="character-classes">Character Classes&lt;/h3>
&lt;ul>
&lt;li>&lt;code>[abc]&lt;/code> - Any of a, b, c&lt;/li>
&lt;li>&lt;code>[^abc]&lt;/code> - Not a, b, c&lt;/li>
&lt;li>&lt;code>[a-z]&lt;/code> - Any lowercase&lt;/li>
&lt;li>&lt;code>[0-9]&lt;/code> - Any digit&lt;/li>
&lt;li>&lt;code>\d&lt;/code> - Digit (with -P)&lt;/li>
&lt;li>&lt;code>\w&lt;/code> - Word character (with -P)&lt;/li>
&lt;/ul>
&lt;h2 id="practical-examples">Practical Examples&lt;/h2>
&lt;h3 id="search-for-ip-addresses">Search for IP addresses:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -E &lt;span style="color:#a5d6ff">&amp;#34;[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}&amp;#34;&lt;/span> file.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="search-for-email-addresses">Search for email addresses:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -E &lt;span style="color:#a5d6ff">&amp;#34;[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}&amp;#34;&lt;/span> file.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="search-in-multiple-files">Search in multiple files:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -r &lt;span style="color:#a5d6ff">&amp;#34;TODO&amp;#34;&lt;/span> /path/to/project
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="search-with-file-patterns">Search with file patterns:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -r --include&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;*.js&amp;#34;&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;console.log&amp;#34;&lt;/span> .
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="count-occurrences">Count occurrences:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -c &lt;span style="color:#a5d6ff">&amp;#34;error&amp;#34;&lt;/span> /var/log/system.log
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="show-only-matching-part">Show only matching part:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -o &lt;span style="color:#a5d6ff">&amp;#34;[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}&amp;#34;&lt;/span> access.log
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="file-operations">File Operations&lt;/h2>
&lt;h3 id="recursive-search">Recursive Search&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -r &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> /path
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grep -R &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> /path
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="includeexclude-files">Include/Exclude Files&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -r --include&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;*.txt&amp;#34;&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grep -r --exclude&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;*.log&amp;#34;&lt;/span> &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> .
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="useful-combinations">Useful Combinations&lt;/h2>
&lt;h3 id="search-for-functions-in-code">Search for functions in code:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -n &lt;span style="color:#a5d6ff">&amp;#34;function.*(&amp;#34;&lt;/span> *.js
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="find-files-containing-pattern">Find files containing pattern:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -l &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> *.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="search-case-insensitive-with-line-numbers">Search case-insensitive with line numbers:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -in &lt;span style="color:#a5d6ff">&amp;#34;error&amp;#34;&lt;/span> /var/log/system.log
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="exclude-binary-files">Exclude binary files:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -I &lt;span style="color:#a5d6ff">&amp;#34;pattern&amp;#34;&lt;/span> *
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="search-for-multiple-patterns">Search for multiple patterns:&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>grep -E &lt;span style="color:#a5d6ff">&amp;#34;error|warning|critical&amp;#34;&lt;/span> /var/log/system.log
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="exit-codes">Exit Codes&lt;/h2>
&lt;ul>
&lt;li>&lt;strong>0&lt;/strong> - Match found&lt;/li>
&lt;li>&lt;strong>1&lt;/strong> - No match found&lt;/li>
&lt;li>&lt;strong>2&lt;/strong> - Error occurred&lt;/li>
&lt;/ul>
&lt;h2 id="tips-and-tricks">Tips and Tricks&lt;/h2>
&lt;ul>
&lt;li>Use &lt;code>grep --help&lt;/code> for complete option list&lt;/li>
&lt;li>Combine with other tools: &lt;code>ps aux | grep process_name&lt;/code>&lt;/li>
&lt;li>Use aliases for common patterns: &lt;code>alias finderr='grep -r &amp;quot;error&amp;quot; .'&lt;/code>&lt;/li>
&lt;li>For complex patterns, consider using &lt;code>egrep&lt;/code> (equivalent to &lt;code>grep -E&lt;/code>)&lt;/li>
&lt;/ul>
&lt;h2 id="see-also">See Also&lt;/h2>
&lt;ul>
&lt;li>&lt;code>egrep&lt;/code> - Extended grep&lt;/li>
&lt;li>&lt;code>fgrep&lt;/code> - Fixed string grep&lt;/li>
&lt;li>&lt;code>rg&lt;/code> (ripgrep) - Faster alternative&lt;/li>
&lt;li>&lt;code>ag&lt;/code> (the silver searcher) - Another fast alternative&lt;/li>
&lt;/ul></description></item><item><title>jq</title><link>http://qref.eknath.dev/tools/jq/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/jq/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>jq is a lightweight and flexible command-line JSON processor. It&amp;rsquo;s like &lt;code>sed&lt;/code> for JSON data, allowing you to slice, filter, map, and transform structured data with ease. Essential for API testing, data processing, and JSON manipulation.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Ubuntu/Debian&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install jq
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># macOS&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install jq
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CentOS/RHEL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo yum install jq
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Windows&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Download from https://stedolan.github.io/jq/download/&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="basic-usage">Basic Usage&lt;/h2>
&lt;h3 id="simple-filtering">Simple Filtering&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pretty print JSON&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Extract field&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.name&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Extract nested field&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;user&amp;#34;:{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30}}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.user.name&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Extract array element&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[&amp;#34;apple&amp;#34;,&amp;#34;banana&amp;#34;,&amp;#34;cherry&amp;#34;]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[0]&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="array-operations">Array Operations&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get array length&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3,4,5]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;length&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get all elements&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3,4,5]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[]&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get specific elements&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3,4,5]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[1:3]&amp;#39;&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Elements 1-2&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3,4,5]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[-2:]&amp;#39;&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Last 2 elements&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="data-types">Data Types&lt;/h2>
&lt;h3 id="working-with-objects">Working with Objects&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get all keys&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30,&amp;#34;city&amp;#34;:&amp;#34;NYC&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;keys&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get all values&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30,&amp;#34;city&amp;#34;:&amp;#34;NYC&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;values&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check if key exists&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;has(&amp;#34;name&amp;#34;)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get type of value&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.age | type&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="working-with-arrays">Working with Arrays&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add element&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;. + [4]&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Remove element&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3,4]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;del(.[1])&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Reverse array&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3,4]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;reverse&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Sort array&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[3,1,4,2]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;sort&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Unique elements&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,2,3,3,3]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;unique&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="filtering-and-selection">Filtering and Selection&lt;/h2>
&lt;h3 id="basic-filters">Basic Filters&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Select objects with specific field&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;age&amp;#34;:25}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[] | select(.age &amp;gt; 25)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Select objects with specific value&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;active&amp;#34;:true},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;active&amp;#34;:false}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[] | select(.active)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Select objects with key&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;},{&amp;#34;age&amp;#34;:30}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[] | select(has(&amp;#34;name&amp;#34;))&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="complex-filters">Complex Filters&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Multiple conditions&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;age&amp;#34;:25}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[] | select(.age &amp;gt; 25 and .name == &amp;#34;John&amp;#34;)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Regular expression matching&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[] | select(.name | test(&amp;#34;J.*&amp;#34;))&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Empty or null values&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;},{&amp;#34;name&amp;#34;:null},{}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.[] | select(.name != null)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="transformations">Transformations&lt;/h2>
&lt;h3 id="map-operations">Map Operations&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Transform array elements&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3,4]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;map(. * 2)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Transform object fields&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;john&amp;#34;},{&amp;#34;name&amp;#34;:&amp;#34;jane&amp;#34;}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;map(.name | ascii_upcase)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add field to objects&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;map(. + {&amp;#34;active&amp;#34;: true})&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="object-construction">Object Construction&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create new object&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;first&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;last&amp;#34;:&amp;#34;Doe&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;{name: (.first + &amp;#34; &amp;#34; + .last)}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Multiple fields&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;{user: .name, years: .age}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Conditional fields&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;{name, age: (if .age &amp;gt; 25 then &amp;#34;adult&amp;#34; else &amp;#34;young&amp;#34; end)}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="string-operations">String Operations&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># String interpolation&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;&amp;#34;Name: \(.name), Age: \(.age)&amp;#34;&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># String manipulation&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;john doe&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.name | ascii_upcase&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John Doe&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.name | ascii_downcase&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;text&amp;#34;:&amp;#34; hello &amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.text | ltrimstr(&amp;#34; &amp;#34;) | rtrimstr(&amp;#34; &amp;#34;)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Split and join&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;path&amp;#34;:&amp;#34;/home/user/file.txt&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.path | split(&amp;#34;/&amp;#34;) | join(&amp;#34;-&amp;#34;)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="advanced-features">Advanced Features&lt;/h2>
&lt;h3 id="conditionals">Conditionals&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># If-then-else&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;age&amp;#34;:30}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;if .age &amp;gt; 18 then &amp;#34;adult&amp;#34; else &amp;#34;minor&amp;#34; end&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Multiple conditions&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;score&amp;#34;:85}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> if .score &amp;gt;= 90 then &amp;#34;A&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> elif .score &amp;gt;= 80 then &amp;#34;B&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> elif .score &amp;gt;= 70 then &amp;#34;C&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> else &amp;#34;F&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> end&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Null handling&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:null}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.name // &amp;#34;Unknown&amp;#34;&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="grouping">Grouping&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Group by field&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;dept&amp;#34;:&amp;#34;IT&amp;#34;},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;dept&amp;#34;:&amp;#34;HR&amp;#34;},{&amp;#34;name&amp;#34;:&amp;#34;Bob&amp;#34;,&amp;#34;dept&amp;#34;:&amp;#34;IT&amp;#34;}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;group_by(.dept)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Group and count&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;type&amp;#34;:&amp;#34;A&amp;#34;},{&amp;#34;type&amp;#34;:&amp;#34;B&amp;#34;},{&amp;#34;type&amp;#34;:&amp;#34;A&amp;#34;},{&amp;#34;type&amp;#34;:&amp;#34;C&amp;#34;}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;group_by(.type) | map({type: .[0].type, count: length})&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="aggregation">Aggregation&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Sum values&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3,4,5]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;add&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Min/max&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,5,3,9,2]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;min&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,5,3,9,2]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;max&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Average&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[1,2,3,4,5]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;add / length&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Count&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;active&amp;#34;:true},{&amp;#34;active&amp;#34;:false},{&amp;#34;active&amp;#34;:true}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;map(select(.active)) | length&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="working-with-complex-data">Working with Complex Data&lt;/h2>
&lt;h3 id="nested-objects">Nested Objects&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Deep field access&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;user&amp;#34;:{&amp;#34;profile&amp;#34;:{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;}}}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.user.profile.name&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Safe navigation&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;user&amp;#34;:{&amp;#34;profile&amp;#34;:{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;}}}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.user.profile.email?&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Recursive descent&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;a&amp;#34;:{&amp;#34;b&amp;#34;:{&amp;#34;c&amp;#34;:1}}}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.. | numbers&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="array-of-objects">Array of Objects&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Extract specific fields&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;age&amp;#34;:25}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;map(.name)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Filter and transform&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;age&amp;#34;:25}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;map(select(.age &amp;gt; 25) | .name)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create lookup table&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;id&amp;#34;:1,&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;},{&amp;#34;id&amp;#34;:2,&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;map({(.id|tostring): .name}) | add&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="flattening">Flattening&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Flatten array&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[[1,2],[3,4],[5,6]]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;flatten&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Flatten one level&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[[1,2],[3,4],[5,6]]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;flatten(1)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Flatten objects&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;a&amp;#34;:{&amp;#34;x&amp;#34;:1,&amp;#34;y&amp;#34;:2},&amp;#34;b&amp;#34;:{&amp;#34;x&amp;#34;:3,&amp;#34;y&amp;#34;:4}}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;to_entries | map(.value) | flatten&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="inputoutput-formats">Input/Output Formats&lt;/h2>
&lt;h3 id="raw-output">Raw Output&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Raw strings&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;}&amp;#39;&lt;/span> | jq -r &lt;span style="color:#a5d6ff">&amp;#39;.name&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Multiple raw strings&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;}]&amp;#39;&lt;/span> | jq -r &lt;span style="color:#a5d6ff">&amp;#39;.[] | .name&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Tab-separated values&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;age&amp;#34;:25}]&amp;#39;&lt;/span> | jq -r &lt;span style="color:#a5d6ff">&amp;#39;.[] | [.name, .age] | @tsv&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="csv-output">CSV Output&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CSV format&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;age&amp;#34;:25}]&amp;#39;&lt;/span> | jq -r &lt;span style="color:#a5d6ff">&amp;#39;.[] | [.name, .age] | @csv&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CSV with headers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;age&amp;#34;:25}]&amp;#39;&lt;/span> | jq -r &lt;span style="color:#a5d6ff">&amp;#39;[&amp;#34;name&amp;#34;,&amp;#34;age&amp;#34;], (.[] | [.name, .age]) | @csv&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="json-lines">JSON Lines&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Convert to JSON Lines&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;}]&amp;#39;&lt;/span> | jq -c &lt;span style="color:#a5d6ff">&amp;#39;.[]&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Convert from JSON Lines&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;}
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;}&amp;#39;&lt;/span> | jq -s &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="practical-examples">Practical Examples&lt;/h2>
&lt;h3 id="api-response-processing">API Response Processing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Extract user names from API response&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://api.github.com/users | jq &lt;span style="color:#a5d6ff">&amp;#39;.[].login&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get specific fields&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://api.github.com/users | jq &lt;span style="color:#a5d6ff">&amp;#39;.[] | {name: .login, url: .html_url}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Filter by criteria&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://api.github.com/users | jq &lt;span style="color:#a5d6ff">&amp;#39;.[] | select(.type == &amp;#34;User&amp;#34;) | .login&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="log-processing">Log Processing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Parse JSON logs&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat application.log | jq &lt;span style="color:#a5d6ff">&amp;#39;select(.level == &amp;#34;ERROR&amp;#34;) | .message&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Count by log level&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat application.log | jq -r &lt;span style="color:#a5d6ff">&amp;#39;.level&amp;#39;&lt;/span> | sort | uniq -c
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Extract timestamp and message&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cat application.log | jq -r &lt;span style="color:#a5d6ff">&amp;#39;&amp;#34;\(.timestamp): \(.message)&amp;#34;&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="configuration-management">Configuration Management&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Update configuration&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;database&amp;#34;:{&amp;#34;host&amp;#34;:&amp;#34;localhost&amp;#34;,&amp;#34;port&amp;#34;:5432}}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.database.host = &amp;#34;newhost&amp;#34;&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Merge configurations&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;a&amp;#34;:1,&amp;#34;b&amp;#34;:2}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;. + {&amp;#34;c&amp;#34;:3,&amp;#34;d&amp;#34;:4}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Remove sensitive data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;user&amp;#34;:&amp;#34;john&amp;#34;,&amp;#34;password&amp;#34;:&amp;#34;secret&amp;#34;,&amp;#34;email&amp;#34;:&amp;#34;john@example.com&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;del(.password)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="data-validation">Data Validation&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check required fields&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:30}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;if has(&amp;#34;name&amp;#34;) and has(&amp;#34;age&amp;#34;) then &amp;#34;valid&amp;#34; else &amp;#34;invalid&amp;#34; end&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Validate data types&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;age&amp;#34;:&amp;#34;30&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;if (.name | type) == &amp;#34;string&amp;#34; and (.age | type) == &amp;#34;number&amp;#34; then &amp;#34;valid&amp;#34; else &amp;#34;invalid&amp;#34; end&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check array length&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;items&amp;#34;:[1,2,3]}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;if (.items | length) &amp;gt; 0 then &amp;#34;has items&amp;#34; else &amp;#34;empty&amp;#34; end&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="error-handling">Error Handling&lt;/h2>
&lt;h3 id="safe-navigation">Safe Navigation&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Optional field access&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;user&amp;#34;:{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;}}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.user.email?&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Default values&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;user&amp;#34;:{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;}}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.user.email // &amp;#34;not provided&amp;#34;&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Try-catch alternative&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;user&amp;#34;:{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;}}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.user.email | select(. != null)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="empty-handling">Empty Handling&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Handle empty arrays&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;if length &amp;gt; 0 then .[0] else &amp;#34;empty&amp;#34; end&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Handle null values&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:null}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.name | if . == null then &amp;#34;N/A&amp;#34; else . end&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Compact output (remove nulls)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;a&amp;#34;:1,&amp;#34;b&amp;#34;:null,&amp;#34;c&amp;#34;:3}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;compact&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="command-line-options">Command-line Options&lt;/h2>
&lt;h3 id="common-options">Common Options&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Compact output&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -c &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Raw output&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -r &lt;span style="color:#a5d6ff">&amp;#39;.name&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Sort keys&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -S &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Slurp mode (read entire input)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -s &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Read from file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span> data.json
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Multiple inputs&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -s &lt;span style="color:#a5d6ff">&amp;#39;.[0] + .[1]&amp;#39;&lt;/span> file1.json file2.json
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="output-control">Output Control&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Tab output&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -t &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Null input&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -n &lt;span style="color:#a5d6ff">&amp;#39;{name: &amp;#34;John&amp;#34;, age: 30}&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Exit status&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -e &lt;span style="color:#a5d6ff">&amp;#39;.success&amp;#39;&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Exit 0 if truthy, 1 if falsy/null&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="advanced-use-cases">Advanced Use Cases&lt;/h2>
&lt;h3 id="stream-processing">Stream Processing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Process large JSON files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq --stream &lt;span style="color:#a5d6ff">&amp;#39;. as $item | if $item[0][0] == &amp;#34;users&amp;#34; then $item else empty end&amp;#39;&lt;/span> large.json
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Streaming parser&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -s https://api.example.com/stream | jq --stream
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="custom-functions">Custom Functions&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Define function&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq &lt;span style="color:#a5d6ff">&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">def double: . * 2;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">def square: . * .;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">[1,2,3,4] | map(double | square)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Function with parameters&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq &lt;span style="color:#a5d6ff">&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">def multiply(n): . * n;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">[1,2,3,4] | map(multiply(5))
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="complex-transformations">Complex Transformations&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pivot data&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;skill&amp;#34;:&amp;#34;Java&amp;#34;},{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;skill&amp;#34;:&amp;#34;Python&amp;#34;},{&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;skill&amp;#34;:&amp;#34;JavaScript&amp;#34;}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">group_by(.name) | map({
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> name: .[0].name,
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> skills: map(.skill)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">})
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Nested grouping&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;[{&amp;#34;dept&amp;#34;:&amp;#34;IT&amp;#34;,&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;,&amp;#34;salary&amp;#34;:50000},{&amp;#34;dept&amp;#34;:&amp;#34;IT&amp;#34;,&amp;#34;name&amp;#34;:&amp;#34;Jane&amp;#34;,&amp;#34;salary&amp;#34;:60000}]&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">group_by(.dept) | map({
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> department: .[0].dept,
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> employees: map({name, salary}),
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"> total_salary: map(.salary) | add
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">})
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="performance-tips">Performance Tips&lt;/h2>
&lt;h3 id="optimization">Optimization&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use streaming for large files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq --stream &lt;span style="color:#a5d6ff">&amp;#39;. | select(.[0][0] == &amp;#34;target_field&amp;#34;)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Limit output early&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq &lt;span style="color:#a5d6ff">&amp;#39;limit(10; .[] | select(.active))&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use compact output for smaller files&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -c &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="memory-management">Memory Management&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Process line by line&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq --stream &lt;span style="color:#a5d6ff">&amp;#39;. | select(length == 2)&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Avoid loading entire file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -c &lt;span style="color:#a5d6ff">&amp;#39;.[]&amp;#39;&lt;/span> large.json | head -100
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="quick-reference">Quick Reference&lt;/h2>
&lt;h3 id="basic-syntax">Basic Syntax&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>. &lt;span style="color:#8b949e;font-style:italic"># Identity (entire input)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>.field &lt;span style="color:#8b949e;font-style:italic"># Field access&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>.&lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>0&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Array index&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>.&lt;span style="color:#ff7b72;font-weight:bold">[]&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Array/object values&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>.&lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>1:3&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Array slice&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>.field? &lt;span style="color:#8b949e;font-style:italic"># Optional field access&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="common-operations">Common Operations&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>length &lt;span style="color:#8b949e;font-style:italic"># Get length&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>keys &lt;span style="color:#8b949e;font-style:italic"># Get keys&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>values &lt;span style="color:#8b949e;font-style:italic"># Get values&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>type &lt;span style="color:#8b949e;font-style:italic"># Get type&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>empty &lt;span style="color:#8b949e;font-style:italic"># Empty value&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>map&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>expr&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Transform array&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">select&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>expr&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Filter&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>has&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>&lt;span style="color:#a5d6ff">&amp;#34;key&amp;#34;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Check key existence&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="string-functions">String Functions&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>ascii_downcase &lt;span style="color:#8b949e;font-style:italic"># Lowercase&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ascii_upcase &lt;span style="color:#8b949e;font-style:italic"># Uppercase&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ltrimstr&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>s&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Left trim&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>rtrimstr&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>s&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Right trim&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>split&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>s&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Split string&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>join&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>s&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Join array&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>test&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>regex&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Test regex&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="math-functions">Math Functions&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>add &lt;span style="color:#8b949e;font-style:italic"># Sum array&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>min &lt;span style="color:#8b949e;font-style:italic"># Minimum&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>max &lt;span style="color:#8b949e;font-style:italic"># Maximum&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sort &lt;span style="color:#8b949e;font-style:italic"># Sort array&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>reverse &lt;span style="color:#8b949e;font-style:italic"># Reverse array&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>unique &lt;span style="color:#8b949e;font-style:italic"># Unique elements&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>group_by&lt;span style="color:#ff7b72;font-weight:bold">(&lt;/span>expr&lt;span style="color:#ff7b72;font-weight:bold">)&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># Group by expression&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="troubleshooting">Troubleshooting&lt;/h2>
&lt;h3 id="common-errors">Common Errors&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Parse error&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;invalid json&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Solution: Fix JSON syntax&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Field doesn&amp;#39;t exist&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.age&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Solution: Use .age? or .age // &amp;#34;default&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Type error&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;{&amp;#34;name&amp;#34;:&amp;#34;John&amp;#34;}&amp;#39;&lt;/span> | jq &lt;span style="color:#a5d6ff">&amp;#39;.name + 1&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Solution: Convert types or check type first&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="debugging">Debugging&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Debug mode&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq --debug &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Verbose output&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq -v &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show parse tree&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>jq --debug &lt;span style="color:#a5d6ff">&amp;#39;.&amp;#39;&lt;/span> 2&amp;gt;&amp;amp;&lt;span style="color:#a5d6ff">1&lt;/span> | head -20
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="see-also">See Also&lt;/h2>
&lt;ul>
&lt;li>&lt;code>man jq&lt;/code> - Manual page&lt;/li>
&lt;li>&lt;a href="https://stedolan.github.io/jq/manual/">jq Manual&lt;/a> - Official documentation&lt;/li>
&lt;li>&lt;a href="https://github.com/stedolan/jq/wiki/Cookbook">jq Cookbook&lt;/a> - Examples&lt;/li>
&lt;li>&lt;code>yq&lt;/code> - YAML processor using jq syntax&lt;/li>
&lt;li>&lt;code>jid&lt;/code> - Interactive jq&lt;/li>
&lt;li>&lt;code>fx&lt;/code> - Interactive JSON viewer&lt;/li>
&lt;/ul></description></item><item><title>Nginx</title><link>http://qref.eknath.dev/tools/nginx/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/nginx/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Nginx (pronounced &amp;ldquo;Engine X&amp;rdquo;) is a high-performance HTTP and reverse proxy server, mail proxy server, and generic TCP/UDP proxy server created by Igor Sysoev in 2004. Originally developed to solve the C10K problem (handling 10,000 concurrent connections), Nginx has become one of the most popular web servers in the world.&lt;/p>
&lt;h3 id="why-use-nginx">Why Use Nginx?&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>High Performance&lt;/strong>: Event-driven architecture handles thousands of concurrent connections with minimal memory usage&lt;/li>
&lt;li>&lt;strong>Low Resource Usage&lt;/strong>: Significantly less memory consumption compared to Apache&lt;/li>
&lt;li>&lt;strong>Reverse Proxy Excellence&lt;/strong>: Outstanding performance as a reverse proxy and load balancer&lt;/li>
&lt;li>&lt;strong>Static Content&lt;/strong>: Extremely efficient at serving static files (HTML, CSS, JS, images)&lt;/li>
&lt;li>&lt;strong>Scalability&lt;/strong>: Handles high traffic loads with ease&lt;/li>
&lt;li>&lt;strong>Flexibility&lt;/strong>: Can function as web server, reverse proxy, load balancer, HTTP cache, and mail proxy&lt;/li>
&lt;li>&lt;strong>Security&lt;/strong>: Regular security updates and robust security features&lt;/li>
&lt;li>&lt;strong>Configuration&lt;/strong>: Simple, readable configuration syntax&lt;/li>
&lt;/ul>
&lt;h3 id="key-features">Key Features&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Event-driven architecture&lt;/strong>: Asynchronous, non-blocking I/O&lt;/li>
&lt;li>&lt;strong>Master/Worker process model&lt;/strong>: Efficient resource management&lt;/li>
&lt;li>&lt;strong>Hot configuration reload&lt;/strong>: Zero-downtime configuration updates&lt;/li>
&lt;li>&lt;strong>SSL/TLS termination&lt;/strong>: Built-in SSL/TLS support with modern protocols&lt;/li>
&lt;li>&lt;strong>HTTP/2 and HTTP/3 support&lt;/strong>: Latest HTTP protocol implementations&lt;/li>
&lt;li>&lt;strong>Compression&lt;/strong>: Built-in gzip and Brotli compression&lt;/li>
&lt;li>&lt;strong>Caching&lt;/strong>: Advanced caching capabilities for improved performance&lt;/li>
&lt;li>&lt;strong>Rate limiting&lt;/strong>: Built-in protection against abuse and DDoS attacks&lt;/li>
&lt;/ul>
&lt;p>Nginx powers some of the world&amp;rsquo;s largest websites including Netflix, Cloudflare, and WordPress.com, making it an excellent choice for serving static content, load balancing, and reverse proxying.&lt;/p></description></item><item><title>Podman</title><link>http://qref.eknath.dev/tools/podman/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/podman/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Podman is a daemonless, rootless container engine for developing, managing, and running OCI containers. It&amp;rsquo;s designed as a drop-in replacement for Docker with enhanced security features and Kubernetes compatibility.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;h3 id="linux">Linux&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Ubuntu/Debian&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt update
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install podman
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CentOS/RHEL/Fedora&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo dnf install podman
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Arch Linux&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo pacman -S podman
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># From source&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git clone https://github.com/containers/podman.git
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>cd podman
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>make
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo make install
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="macos">macOS&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Using Homebrew&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install podman
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Initialize and start machine&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman machine init
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman machine start
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Verify installation&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman version
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="windows">Windows&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Using Chocolatey&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>choco install podman
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Using Scoop&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>scoop install podman
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Initialize machine&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman machine init
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman machine start
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="basic-commands">Basic Commands&lt;/h2>
&lt;h3 id="container-management">Container Management&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run container&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run hello-world
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run -it ubuntu:latest /bin/bash
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List containers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman ps &lt;span style="color:#8b949e;font-style:italic"># Running containers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman ps -a &lt;span style="color:#8b949e;font-style:italic"># All containers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start/stop containers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman start container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman stop container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman restart container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Remove containers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman rm container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman rm -f container_name &lt;span style="color:#8b949e;font-style:italic"># Force remove&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="image-management">Image Management&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pull images&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pull ubuntu:latest
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pull docker.io/nginx:alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List images&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman images
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman image ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Remove images&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman rmi image_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman rmi -f image_name &lt;span style="color:#8b949e;font-style:italic"># Force remove&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Build images&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman build -t my-app .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman build -f Dockerfile.prod -t my-app:prod .
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="registry-operations">Registry Operations&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Login to registry&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman login registry.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman login docker.io
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push images&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman push my-app:latest registry.example.com/my-app:latest
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Search images&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman search nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman search --limit &lt;span style="color:#a5d6ff">10&lt;/span> python
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="advanced-container-operations">Advanced Container Operations&lt;/h2>
&lt;h3 id="running-containers">Running Containers&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run with port mapping&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run -p 8080:80 nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run with volume mounting&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run -v /host/path:/container/path nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run with environment variables&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run -e &lt;span style="color:#79c0ff">ENV_VAR&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>value nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run in detached mode&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run -d --name web-server nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run with resource limits&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --memory&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>1g --cpus&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>0.5 nginx
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="container-networking">Container Networking&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create network&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network create mynetwork
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List networks&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run container on specific network&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --network mynetwork nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Connect container to network&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network connect mynetwork container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Disconnect from network&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network disconnect mynetwork container_name
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="volume-management">Volume Management&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create volume&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman volume create myvolume
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List volumes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman volume ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Inspect volume&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman volume inspect myvolume
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use volume with container&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run -v myvolume:/data nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Remove volume&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman volume rm myvolume
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="pods">Pods&lt;/h2>
&lt;h3 id="pod-management">Pod Management&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create pod&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod create --name mypod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create pod with port mapping&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod create --name mypod -p 8080:80
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List pods&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add container to pod&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run -dt --pod mypod nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run -dt --pod mypod redis
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start/stop pod&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod start mypod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod stop mypod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Remove pod&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod rm mypod
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod rm -f mypod &lt;span style="color:#8b949e;font-style:italic"># Force remove&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="pod-networking">Pod Networking&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create pod with custom network&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod create --name mypod --network mynetwork
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pod with multiple ports&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod create --name mypod -p 8080:80 -p 3000:3000
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pod with shared volumes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod create --name mypod -v /host/data:/shared
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="kubernetes-integration">Kubernetes Integration&lt;/h2>
&lt;h3 id="generate-kubernetes-yaml">Generate Kubernetes YAML&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Generate pod YAML&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman generate kube mypod &amp;gt; mypod.yaml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Generate deployment YAML&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman generate kube --type deployment mypod &amp;gt; deployment.yaml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Generate service YAML&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman generate kube --service mypod &amp;gt; service.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="play-kubernetes-yaml">Play Kubernetes YAML&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Deploy from YAML&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman play kube deployment.yaml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Deploy with custom name&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman play kube --name custom-name deployment.yaml
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Remove deployment&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman play kube --down deployment.yaml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="rootless-containers">Rootless Containers&lt;/h2>
&lt;h3 id="rootless-setup">Rootless Setup&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Install rootless dependencies&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install slirp4netns fuse-overlayfs
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Configure user namespaces&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#39;user.max_user_namespaces=28633&amp;#39;&lt;/span> | sudo tee -a /etc/sysctl.d/userns.conf
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Set up subuid/subgid&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 &lt;span style="color:#79c0ff">$USER&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Enable lingering&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo loginctl enable-linger &lt;span style="color:#79c0ff">$USER&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="rootless-operations">Rootless Operations&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run rootless container&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --rm -it ubuntu:latest
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check rootless status&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman info | grep -i root
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run with different user&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --user 1000:1000 nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Map user namespace&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --userns&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>keep-id nginx
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="security-features">Security Features&lt;/h2>
&lt;h3 id="security-options">Security Options&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run with SELinux labels&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --security-opt &lt;span style="color:#79c0ff">label&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>level:s0:c123,c456 nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run with seccomp profile&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --security-opt &lt;span style="color:#79c0ff">seccomp&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>unconfined nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run with AppArmor profile&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --security-opt &lt;span style="color:#79c0ff">apparmor&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>docker-default nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run with no-new-privileges&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --security-opt no-new-privileges nginx
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="capabilities">Capabilities&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Drop capabilities&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --cap-drop ALL --cap-add NET_BIND_SERVICE nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add capabilities&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --cap-add SYS_ADMIN nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run privileged&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --privileged nginx
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="build-images">Build Images&lt;/h2>
&lt;h3 id="dockerfile">Dockerfile&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-dockerfile" data-lang="dockerfile">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">FROM&lt;/span>&lt;span style="color:#a5d6ff"> ubuntu:latest&lt;/span>&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f85149">&lt;/span>&lt;span style="color:#ff7b72">RUN&lt;/span> apt-get update &lt;span style="color:#ff7b72;font-weight:bold">&amp;amp;&amp;amp;&lt;/span> apt-get install -y nginx&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f85149">&lt;/span>&lt;span style="color:#ff7b72">COPY&lt;/span> nginx.conf /etc/nginx/nginx.conf&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f85149">&lt;/span>&lt;span style="color:#ff7b72">COPY&lt;/span> . /var/www/html/&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f85149">&lt;/span>&lt;span style="color:#ff7b72">EXPOSE&lt;/span>&lt;span style="color:#a5d6ff"> 80&lt;/span>&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f85149">&lt;/span>&lt;span style="color:#ff7b72">CMD&lt;/span> [&lt;span style="color:#a5d6ff">&amp;#34;nginx&amp;#34;&lt;/span>, &lt;span style="color:#a5d6ff">&amp;#34;-g&amp;#34;&lt;/span>, &lt;span style="color:#a5d6ff">&amp;#34;daemon off;&amp;#34;&lt;/span>]&lt;span style="color:#f85149">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="build-commands">Build Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Build image&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman build -t myapp .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Build with build args&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman build --build-arg &lt;span style="color:#79c0ff">VERSION&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>1.0 -t myapp .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Build with different file&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman build -f Dockerfile.prod -t myapp:prod .
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Build with context&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman build -t myapp /path/to/context
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Multi-stage build&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman build --target production -t myapp:prod .
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="container-inspection">Container Inspection&lt;/h2>
&lt;h3 id="inspect-commands">Inspect Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Inspect container&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman inspect container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Inspect image&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman inspect image_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Get specific info&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman inspect --format&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>&lt;span style="color:#a5d6ff">&amp;#39;{{.NetworkSettings.IPAddress}}&amp;#39;&lt;/span> container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># View logs&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman logs container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman logs -f container_name &lt;span style="color:#8b949e;font-style:italic"># Follow logs&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman logs --since&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>1h container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># View processes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman top container_name
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="statistics">Statistics&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Container stats&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman stats container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># All container stats&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman stats
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># System info&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman info
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman system info
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># System events&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman events
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="docker-compatibility">Docker Compatibility&lt;/h2>
&lt;h3 id="docker-command-mapping">Docker Command Mapping&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Docker to Podman aliases&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>alias &lt;span style="color:#79c0ff">docker&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>podman
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Or set up podman-docker package&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install podman-docker
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Docker-compose equivalent&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman-compose up
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman-compose down
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="docker-socket">Docker Socket&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Enable podman socket&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>systemctl --user enable podman.socket
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>systemctl --user start podman.socket
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use with docker clients&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export &lt;span style="color:#79c0ff">DOCKER_HOST&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>unix:///run/user/&lt;span style="color:#79c0ff">$UID&lt;/span>/podman/podman.sock
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="systemd-integration">Systemd Integration&lt;/h2>
&lt;h3 id="user-services">User Services&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Generate systemd unit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman generate systemd --new --name mycontainer &amp;gt; ~/.config/systemd/user/mycontainer.service
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Enable and start service&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>systemctl --user enable mycontainer.service
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>systemctl --user start mycontainer.service
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check status&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>systemctl --user status mycontainer.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="system-services">System Services&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Generate system service&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo podman generate systemd --new --name mycontainer &amp;gt; /etc/systemd/system/mycontainer.service
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Enable and start&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo systemctl enable mycontainer.service
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo systemctl start mycontainer.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="compose-alternative">Compose Alternative&lt;/h2>
&lt;h3 id="podman-compose">Podman Compose&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Install podman-compose&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>pip install podman-compose
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Or use docker-compose with podman&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo ln -s /usr/bin/podman /usr/bin/docker
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="docker-compose-file">Docker Compose File&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#7ee787">version&lt;/span>:&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#a5d6ff">&amp;#39;3&amp;#39;&lt;/span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681">&lt;/span>&lt;span style="color:#7ee787">services&lt;/span>:&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">web&lt;/span>:&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">image&lt;/span>:&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#a5d6ff">nginx:alpine&lt;/span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">ports&lt;/span>:&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>- &lt;span style="color:#a5d6ff">&amp;#34;8080:80&amp;#34;&lt;/span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">volumes&lt;/span>:&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>- &lt;span style="color:#a5d6ff">./html:/usr/share/nginx/html&lt;/span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> 
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">db&lt;/span>:&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">image&lt;/span>:&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#a5d6ff">postgres:13&lt;/span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">environment&lt;/span>:&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">POSTGRES_DB&lt;/span>:&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#a5d6ff">mydb&lt;/span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">POSTGRES_USER&lt;/span>:&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#a5d6ff">user&lt;/span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">POSTGRES_PASSWORD&lt;/span>:&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#a5d6ff">password&lt;/span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">volumes&lt;/span>:&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>- &lt;span style="color:#a5d6ff">db_data:/var/lib/postgresql/data&lt;/span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681">&lt;/span>&lt;span style="color:#7ee787">volumes&lt;/span>:&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6e7681"> &lt;/span>&lt;span style="color:#7ee787">db_data&lt;/span>:&lt;span style="color:#6e7681">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="compose-commands">Compose Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start services&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman-compose up
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman-compose up -d
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Stop services&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman-compose down
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Build services&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman-compose build
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># View logs&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman-compose logs
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="registry-configuration">Registry Configuration&lt;/h2>
&lt;h3 id="registry-setup">Registry Setup&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Configure registries&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo vim /etc/containers/registries.conf
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add registry&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>registries.search&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">registries&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>&lt;span style="color:#a5d6ff">&amp;#39;docker.io&amp;#39;&lt;/span>, &lt;span style="color:#a5d6ff">&amp;#39;registry.fedoraproject.org&amp;#39;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>registries.insecure&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">registries&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>&lt;span style="color:#a5d6ff">&amp;#39;localhost:5000&amp;#39;&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="private-registry">Private Registry&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Login to private registry&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman login registry.example.com
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Push to private registry&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman tag myapp:latest registry.example.com/myapp:latest
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman push registry.example.com/myapp:latest
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Pull from private registry&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pull registry.example.com/myapp:latest
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="troubleshooting">Troubleshooting&lt;/h2>
&lt;h3 id="common-issues">Common Issues&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check system&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman info
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check version&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman version
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Reset system&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman system reset
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clean up&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman system prune
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman system prune -a
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="storage-issues">Storage Issues&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check storage&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman system df
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clean up storage&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman image prune
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman container prune
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman volume prune
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="network-issues">Network Issues&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Reset network&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network prune
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Check network config&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network inspect bridge
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Restart networking&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman machine restart
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="performance-optimization">Performance Optimization&lt;/h2>
&lt;h3 id="container-optimization">Container Optimization&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use specific tags&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pull nginx:alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Multi-stage builds&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>FROM node:alpine AS builder
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Build stage&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>FROM nginx:alpine
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Runtime stage&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Resource limits&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --memory&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>512m --cpus&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>0.5 nginx
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="storage-optimization">Storage Optimization&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use overlay storage&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman info | grep -i storage
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Configure storage&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo vim /etc/containers/storage.conf
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Clean up regularly&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman system prune -a
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="monitoring">Monitoring&lt;/h2>
&lt;h3 id="container-monitoring">Container Monitoring&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Live stats&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman stats
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Health checks&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman healthcheck run container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># System events&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman events --since&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>1h
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="logging">Logging&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Container logs&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman logs container_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># System logs&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>journalctl --user -u podman.service
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Log drivers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --log-driver&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>journald nginx
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="security-best-practices">Security Best Practices&lt;/h2>
&lt;h3 id="container-security">Container Security&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run as non-root&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --user 1000:1000 nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Read-only root filesystem&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --read-only nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Drop capabilities&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman run --cap-drop ALL --cap-add NET_BIND_SERVICE nginx
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Use trusted images&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pull registry.redhat.io/rhel8/nginx
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="host-security">Host Security&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Regular updates&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt update &lt;span style="color:#ff7b72;font-weight:bold">&amp;amp;&amp;amp;&lt;/span> sudo apt upgrade
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># SELinux enforcement&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo setsebool -P container_manage_cgroup on
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Firewall rules&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo ufw allow 8080/tcp
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="quick-reference">Quick Reference&lt;/h2>
&lt;h3 id="essential-commands">Essential Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>podman run &lt;span style="color:#8b949e;font-style:italic"># Run container&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman ps &lt;span style="color:#8b949e;font-style:italic"># List containers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman images &lt;span style="color:#8b949e;font-style:italic"># List images&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pull &lt;span style="color:#8b949e;font-style:italic"># Pull image&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman build &lt;span style="color:#8b949e;font-style:italic"># Build image&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman stop &lt;span style="color:#8b949e;font-style:italic"># Stop container&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman rm &lt;span style="color:#8b949e;font-style:italic"># Remove container&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman rmi &lt;span style="color:#8b949e;font-style:italic"># Remove image&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="pod-commands">Pod Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>podman pod create &lt;span style="color:#8b949e;font-style:italic"># Create pod&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod ls &lt;span style="color:#8b949e;font-style:italic"># List pods&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod start &lt;span style="color:#8b949e;font-style:italic"># Start pod&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod stop &lt;span style="color:#8b949e;font-style:italic"># Stop pod&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman pod rm &lt;span style="color:#8b949e;font-style:italic"># Remove pod&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="system-commands">System Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>podman info &lt;span style="color:#8b949e;font-style:italic"># System info&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman version &lt;span style="color:#8b949e;font-style:italic"># Version info&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman system prune &lt;span style="color:#8b949e;font-style:italic"># Clean up&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman system df &lt;span style="color:#8b949e;font-style:italic"># Storage usage&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman events &lt;span style="color:#8b949e;font-style:italic"># System events&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="network-commands">Network Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>podman network create &lt;span style="color:#8b949e;font-style:italic"># Create network&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network ls &lt;span style="color:#8b949e;font-style:italic"># List networks&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network inspect &lt;span style="color:#8b949e;font-style:italic"># Inspect network&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network connect &lt;span style="color:#8b949e;font-style:italic"># Connect container&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>podman network disconnect &lt;span style="color:#8b949e;font-style:italic"># Disconnect container&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="see-also">See Also&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://docs.podman.io/">Podman Documentation&lt;/a> - Official documentation&lt;/li>
&lt;li>&lt;a href="https://github.com/containers/podman">Podman GitHub&lt;/a> - Source code&lt;/li>
&lt;li>&lt;a href="https://github.com/containers/podman/tree/main/docs/tutorials">Podman Tutorials&lt;/a> - Official tutorials&lt;/li>
&lt;li>&lt;a href="https://buildah.io/">Buildah&lt;/a> - Container image builder&lt;/li>
&lt;li>&lt;a href="https://github.com/containers/skopeo">Skopeo&lt;/a> - Container image operations&lt;/li>
&lt;li>&lt;code>man podman&lt;/code> - Manual pages&lt;/li>
&lt;/ul></description></item><item><title>Regex</title><link>http://qref.eknath.dev/tools/regex/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/regex/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Regular expressions (regex) are patterns used to match character combinations in strings. They&amp;rsquo;re essential for text processing, validation, searching, and data extraction across virtually all programming languages and tools.&lt;/p>
&lt;h2 id="basic-syntax">Basic Syntax&lt;/h2>
&lt;h3 id="literal-characters">Literal Characters&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">hello # Matches &amp;#34;hello&amp;#34; exactly
123 # Matches &amp;#34;123&amp;#34; exactly
&lt;/code>&lt;/pre>&lt;h3 id="meta-characters">Meta Characters&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">. # Any character except newline
^ # Start of string/line
$ # End of string/line
\ # Escape character
| # OR operator
() # Group
[] # Character class
{} # Quantifier
&lt;/code>&lt;/pre>&lt;h2 id="character-classes">Character Classes&lt;/h2>
&lt;h3 id="predefined-classes">Predefined Classes&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">. # Any character except newline
\d # Any digit (0-9)
\D # Any non-digit
\w # Any word character (a-z, A-Z, 0-9, _)
\W # Any non-word character
\s # Any whitespace character
\S # Any non-whitespace character
&lt;/code>&lt;/pre>&lt;h3 id="custom-classes">Custom Classes&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">[abc] # Any of a, b, or c
[a-z] # Any lowercase letter
[A-Z] # Any uppercase letter
[0-9] # Any digit
[^abc] # Any character except a, b, or c
[a-zA-Z0-9] # Any alphanumeric character
&lt;/code>&lt;/pre>&lt;h2 id="quantifiers">Quantifiers&lt;/h2>
&lt;h3 id="basic-quantifiers">Basic Quantifiers&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">* # 0 or more
+ # 1 or more
? # 0 or 1 (optional)
{n} # Exactly n times
{n,} # n or more times
{n,m} # Between n and m times
&lt;/code>&lt;/pre>&lt;h3 id="examples">Examples&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">a* # &amp;#34;&amp;#34;, &amp;#34;a&amp;#34;, &amp;#34;aa&amp;#34;, &amp;#34;aaa&amp;#34;, ...
a+ # &amp;#34;a&amp;#34;, &amp;#34;aa&amp;#34;, &amp;#34;aaa&amp;#34;, ... (not empty)
a? # &amp;#34;&amp;#34; or &amp;#34;a&amp;#34;
a{3} # &amp;#34;aaa&amp;#34; exactly
a{2,4} # &amp;#34;aa&amp;#34;, &amp;#34;aaa&amp;#34;, or &amp;#34;aaaa&amp;#34;
&lt;/code>&lt;/pre>&lt;h2 id="anchors">Anchors&lt;/h2>
&lt;h3 id="position-anchors">Position Anchors&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">^ # Start of string/line
$ # End of string/line
\b # Word boundary
\B # Non-word boundary
&lt;/code>&lt;/pre>&lt;h3 id="examples-1">Examples&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">^hello # &amp;#34;hello&amp;#34; at start of line
world$ # &amp;#34;world&amp;#34; at end of line
\bcat\b # &amp;#34;cat&amp;#34; as whole word
\Bcat\B # &amp;#34;cat&amp;#34; not as whole word
&lt;/code>&lt;/pre>&lt;h2 id="groups-and-capturing">Groups and Capturing&lt;/h2>
&lt;h3 id="groups">Groups&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">(abc) # Capture group
(?:abc) # Non-capturing group
(?P&amp;lt;name&amp;gt;abc) # Named group (Python)
(?&amp;lt;name&amp;gt;abc) # Named group (C#, Java)
&lt;/code>&lt;/pre>&lt;h3 id="backreferences">Backreferences&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">(cat)\1 # Matches &amp;#34;catcat&amp;#34;
(\w+)\s+\1 # Matches repeated words
&lt;/code>&lt;/pre>&lt;h2 id="common-patterns">Common Patterns&lt;/h2>
&lt;h3 id="email-validation">Email Validation&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
&lt;/code>&lt;/pre>&lt;h3 id="phone-numbers">Phone Numbers&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">^\+?1?[-.\s]?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$
&lt;/code>&lt;/pre>&lt;h3 id="urls">URLs&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&amp;amp;//=]*)$
&lt;/code>&lt;/pre>&lt;h3 id="ipv4-address">IPv4 Address&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
&lt;/code>&lt;/pre>&lt;h3 id="date-formats">Date Formats&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex"># MM/DD/YYYY
^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$

# YYYY-MM-DD
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$
&lt;/code>&lt;/pre>&lt;h3 id="credit-card-numbers">Credit Card Numbers&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex"># Visa
^4[0-9]{12}(?:[0-9]{3})?$

# MasterCard
^5[1-5][0-9]{14}$

# American Express
^3[47][0-9]{13}$
&lt;/code>&lt;/pre>&lt;h2 id="language-specific-usage">Language-Specific Usage&lt;/h2>
&lt;h3 id="javascript">JavaScript&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">// Create regex
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&lt;/span>&lt;span style="color:#ff7b72">const&lt;/span> regex &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#f85149">/pattern/flags;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">const&lt;/span> regex &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> &lt;span style="color:#ff7b72">new&lt;/span> RegExp(&lt;span style="color:#a5d6ff">&amp;#39;pattern&amp;#39;&lt;/span>, &lt;span style="color:#a5d6ff">&amp;#39;flags&amp;#39;&lt;/span>);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">// Test match
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&lt;/span>regex.test(string);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">// Find matches
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic">&lt;/span>string.match(regex);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>string.search(regex);
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>string.replace(regex, replacement);
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="python">Python&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-python" data-lang="python">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#ff7b72">import&lt;/span> &lt;span style="color:#ff7b72">re&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Compile regex&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>pattern &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span> re&lt;span style="color:#ff7b72;font-weight:bold">.&lt;/span>compile(&lt;span style="color:#79c0ff">r&lt;/span>&lt;span style="color:#a5d6ff">&amp;#39;regex_pattern&amp;#39;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Match functions&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>re&lt;span style="color:#ff7b72;font-weight:bold">.&lt;/span>&lt;span style="color:#ff7b72">match&lt;/span>(pattern, string) &lt;span style="color:#8b949e;font-style:italic"># Match at beginning&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>re&lt;span style="color:#ff7b72;font-weight:bold">.&lt;/span>search(pattern, string) &lt;span style="color:#8b949e;font-style:italic"># Find first match&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>re&lt;span style="color:#ff7b72;font-weight:bold">.&lt;/span>findall(pattern, string) &lt;span style="color:#8b949e;font-style:italic"># Find all matches&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>re&lt;span style="color:#ff7b72;font-weight:bold">.&lt;/span>sub(pattern, replacement, string) &lt;span style="color:#8b949e;font-style:italic"># Replace&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="bashgrep">Bash/grep&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Basic grep&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grep &lt;span style="color:#a5d6ff">&amp;#39;pattern&amp;#39;&lt;/span> file.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Extended regex&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grep -E &lt;span style="color:#a5d6ff">&amp;#39;pattern&amp;#39;&lt;/span> file.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>egrep &lt;span style="color:#a5d6ff">&amp;#39;pattern&amp;#39;&lt;/span> file.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Perl-compatible regex&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>grep -P &lt;span style="color:#a5d6ff">&amp;#39;pattern&amp;#39;&lt;/span> file.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="sed">sed&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Replace with regex&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sed &lt;span style="color:#a5d6ff">&amp;#39;s/pattern/replacement/g&amp;#39;&lt;/span> file.txt
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Extended regex&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sed -E &lt;span style="color:#a5d6ff">&amp;#39;s/pattern/replacement/g&amp;#39;&lt;/span> file.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="flagsmodifiers">Flags/Modifiers&lt;/h2>
&lt;h3 id="common-flags">Common Flags&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">i # Case insensitive
g # Global (find all matches)
m # Multiline (^ and $ match line breaks)
s # Dot matches newline
x # Extended (ignore whitespace)
&lt;/code>&lt;/pre>&lt;h3 id="examples-2">Examples&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-javascript" data-lang="javascript">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">/hello/i&lt;/span> &lt;span style="color:#f85149">#&lt;/span> Case insensitive
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">/hello/g&lt;/span> &lt;span style="color:#f85149">#&lt;/span> Global search
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#79c0ff">/hello/gi&lt;/span> &lt;span style="color:#f85149">#&lt;/span> Case insensitive &lt;span style="color:#ff7b72;font-weight:bold">+&lt;/span> global
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="advanced-features">Advanced Features&lt;/h2>
&lt;h3 id="lookaheadlookbehind">Lookahead/Lookbehind&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">(?=pattern) # Positive lookahead
(?!pattern) # Negative lookahead
(?&amp;lt;=pattern) # Positive lookbehind
(?&amp;lt;!pattern) # Negative lookbehind
&lt;/code>&lt;/pre>&lt;h3 id="examples-3">Examples&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">\d+(?=px) # Numbers followed by &amp;#34;px&amp;#34;
\d+(?!px) # Numbers not followed by &amp;#34;px&amp;#34;
(?&amp;lt;=\$)\d+ # Numbers preceded by &amp;#34;$&amp;#34;
(?&amp;lt;!\$)\d+ # Numbers not preceded by &amp;#34;$&amp;#34;
&lt;/code>&lt;/pre>&lt;h2 id="practical-examples">Practical Examples&lt;/h2>
&lt;h3 id="extract-domain-from-email">Extract Domain from Email&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})
&lt;/code>&lt;/pre>&lt;h3 id="find-html-tags">Find HTML Tags&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">&amp;lt;\/?[a-zA-Z][^&amp;gt;]*&amp;gt;
&lt;/code>&lt;/pre>&lt;h3 id="match-quoted-strings">Match Quoted Strings&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">&amp;#34;([^&amp;#34;\\]|\\.)*&amp;#34;
&lt;/code>&lt;/pre>&lt;h3 id="find-css-colors">Find CSS Colors&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">#[0-9a-fA-F]{3,6}
&lt;/code>&lt;/pre>&lt;h3 id="extract-urls-from-text">Extract URLs from Text&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">https?:\/\/[^\s]+
&lt;/code>&lt;/pre>&lt;h3 id="match-json-values">Match JSON Values&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">&amp;#34;[^&amp;#34;]*&amp;#34;:\s*(&amp;#34;[^&amp;#34;]*&amp;#34;|\d+|true|false|null)
&lt;/code>&lt;/pre>&lt;h2 id="testing-and-debugging">Testing and Debugging&lt;/h2>
&lt;h3 id="online-tools">Online Tools&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="https://regex101.com">regex101.com&lt;/a> - Interactive regex tester&lt;/li>
&lt;li>&lt;a href="https://regexr.com">regexr.com&lt;/a> - Visual regex builder&lt;/li>
&lt;li>&lt;a href="https://regexpal.com">regexpal.com&lt;/a> - Simple regex tester&lt;/li>
&lt;/ul>
&lt;h3 id="command-line-testing">Command Line Testing&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Test with grep&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#34;test string&amp;#34;&lt;/span> | grep -E &lt;span style="color:#a5d6ff">&amp;#39;pattern&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Test with sed&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>echo &lt;span style="color:#a5d6ff">&amp;#34;test string&amp;#34;&lt;/span> | sed &lt;span style="color:#a5d6ff">&amp;#39;s/pattern/replacement/&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Test with Python&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>python3 -c &lt;span style="color:#a5d6ff">&amp;#34;import re; print(re.search(r&amp;#39;pattern&amp;#39;, &amp;#39;test string&amp;#39;))&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="performance-tips">Performance Tips&lt;/h2>
&lt;h3 id="best-practices">Best Practices&lt;/h3>
&lt;ul>
&lt;li>Use specific characters instead of &lt;code>.&lt;/code> when possible&lt;/li>
&lt;li>Avoid nested quantifiers like &lt;code>(a+)+&lt;/code>&lt;/li>
&lt;li>Use non-capturing groups &lt;code>(?:...)&lt;/code> when you don&amp;rsquo;t need the match&lt;/li>
&lt;li>Anchor patterns with &lt;code>^&lt;/code> and &lt;code>$&lt;/code> when appropriate&lt;/li>
&lt;li>Use word boundaries &lt;code>\b&lt;/code> for word matching&lt;/li>
&lt;/ul>
&lt;h3 id="common-pitfalls">Common Pitfalls&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Greedy vs Non-greedy&lt;/strong>: &lt;code>.*&lt;/code> vs &lt;code>.*?&lt;/code>&lt;/li>
&lt;li>&lt;strong>Backtracking&lt;/strong>: Avoid complex nested patterns&lt;/li>
&lt;li>&lt;strong>Case sensitivity&lt;/strong>: Remember to use &lt;code>i&lt;/code> flag when needed&lt;/li>
&lt;li>&lt;strong>Escaping&lt;/strong>: Don&amp;rsquo;t forget to escape special characters&lt;/li>
&lt;/ul>
&lt;h2 id="quick-reference">Quick Reference&lt;/h2>
&lt;h3 id="most-common-patterns">Most Common Patterns&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">\d+ # One or more digits
\w+ # One or more word characters
\s+ # One or more whitespace
[a-zA-Z]+ # One or more letters
\b\w+\b # Whole words
^.+$ # Entire line
.* # Any characters (greedy)
.*? # Any characters (non-greedy)
&lt;/code>&lt;/pre>&lt;h3 id="escape-sequences">Escape Sequences&lt;/h3>
&lt;pre tabindex="0">&lt;code class="language-regex" data-lang="regex">\. # Literal dot
\* # Literal asterisk
\+ # Literal plus
\? # Literal question mark
\\ # Literal backslash
\( # Literal parenthesis
\[ # Literal bracket
\{ # Literal brace
\| # Literal pipe
&lt;/code>&lt;/pre>&lt;h2 id="see-also">See Also&lt;/h2>
&lt;ul>
&lt;li>&lt;code>man grep&lt;/code> - Pattern matching in files&lt;/li>
&lt;li>&lt;code>man sed&lt;/code> - Stream editor with regex support&lt;/li>
&lt;li>&lt;code>man awk&lt;/code> - Pattern scanning and processing&lt;/li>
&lt;li>&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">MDN Regex Guide&lt;/a>&lt;/li>
&lt;li>&lt;a href="https://docs.python.org/3/library/re.html">Python re module&lt;/a>&lt;/li>
&lt;/ul></description></item><item><title>Tmux</title><link>http://qref.eknath.dev/tools/tmux/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/tmux/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Tmux is a terminal multiplexer that allows you to run multiple terminal sessions, windows, and panes within a single terminal window. It&amp;rsquo;s essential for remote work, development environments, and maintaining persistent sessions.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Ubuntu/Debian&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install tmux
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># macOS&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install tmux
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CentOS/RHEL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo yum install tmux
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Arch Linux&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo pacman -S tmux
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="basic-concepts">Basic Concepts&lt;/h2>
&lt;h3 id="hierarchy">Hierarchy&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Session&lt;/strong>: Top-level container for windows&lt;/li>
&lt;li>&lt;strong>Window&lt;/strong>: Contains one or more panes&lt;/li>
&lt;li>&lt;strong>Pane&lt;/strong>: Individual terminal instance&lt;/li>
&lt;/ul>
&lt;h3 id="default-prefix-key">Default Prefix Key&lt;/h3>
&lt;ul>
&lt;li>&lt;strong>Prefix&lt;/strong>: &lt;code>Ctrl+b&lt;/code> (can be customized)&lt;/li>
&lt;li>All tmux commands start with the prefix key&lt;/li>
&lt;/ul>
&lt;h2 id="session-management">Session Management&lt;/h2>
&lt;h3 id="creating-sessions">Creating Sessions&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create new session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-session
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create named session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-session -s session_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new -s work
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create detached session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-session -d -s background
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="listing-sessions">Listing Sessions&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List all sessions&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux list-sessions
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux ls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show sessions in tmux&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b s
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="attaching-to-sessions">Attaching to Sessions&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Attach to last session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux attach
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux a
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Attach to specific session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux attach -t session_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux a -t work
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Attach or create session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-session -A -s session_name
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="detaching-from-sessions">Detaching from Sessions&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Detach from current session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b d
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Detach from command line&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux detach
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="session-control">Session Control&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Kill session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux kill-session -t session_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Kill all sessions&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux kill-server
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Rename session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b $
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="window-management">Window Management&lt;/h2>
&lt;h3 id="creating-windows">Creating Windows&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create new window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b c
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create window with name&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b c
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Then rename: Ctrl+b ,&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="navigating-windows">Navigating Windows&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Next window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b n
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Previous window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b p
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Go to window by number&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b 0-9
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Go to window by name&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b f
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List windows&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b w
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="window-control">Window Control&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Rename window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b ,
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Kill window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b &amp;amp;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Move window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b .
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="pane-management">Pane Management&lt;/h2>
&lt;h3 id="creating-panes">Creating Panes&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Split horizontally (top/bottom)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b &lt;span style="color:#a5d6ff">&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"># Split vertically (left/right)
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">Ctrl+b %
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff"># Split with custom command
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#a5d6ff">Ctrl+b &amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Then type command&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="navigating-panes">Navigating Panes&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Move between panes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b arrow keys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b h/j/k/l &lt;span style="color:#8b949e;font-style:italic"># vim-style (if configured)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Go to next pane&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b o
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Go to previous pane&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b ;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show pane numbers&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b q
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="resizing-panes">Resizing Panes&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Resize pane (arrow keys)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b Ctrl+arrow keys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Resize by 5 cells&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b Alt+arrow keys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Make pane full screen&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b z
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Balance panes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b Alt+1 &lt;span style="color:#8b949e;font-style:italic"># horizontal&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b Alt+2 &lt;span style="color:#8b949e;font-style:italic"># vertical&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="pane-control">Pane Control&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Kill pane&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b x
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Break pane to new window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b !
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Move pane to another window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b :
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>move-pane -t window_name
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Swap panes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b &lt;span style="color:#ff7b72;font-weight:bold">{&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># swap with previous&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b &lt;span style="color:#ff7b72;font-weight:bold">}&lt;/span> &lt;span style="color:#8b949e;font-style:italic"># swap with next&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="copy-mode">Copy Mode&lt;/h2>
&lt;h3 id="entering-copy-mode">Entering Copy Mode&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Enter copy mode&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b &lt;span style="color:#ff7b72;font-weight:bold">[&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Search in copy mode&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b Ctrl+s &lt;span style="color:#8b949e;font-style:italic"># forward&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b Ctrl+r &lt;span style="color:#8b949e;font-style:italic"># backward&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="copy-mode-navigation">Copy Mode Navigation&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Move cursor&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Arrow keys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>h/j/k/l &lt;span style="color:#8b949e;font-style:italic"># vim-style&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Page up/down&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Page Up/Page Down
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b/Ctrl+f &lt;span style="color:#8b949e;font-style:italic"># vim-style&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Go to line&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>g &lt;span style="color:#8b949e;font-style:italic"># beginning&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>G &lt;span style="color:#8b949e;font-style:italic"># end&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="selecting-and-copying">Selecting and Copying&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start selection&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Space
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Copy selection&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Enter
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Paste&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b &lt;span style="color:#ff7b72;font-weight:bold">]&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show paste buffer&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b &lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="command-mode">Command Mode&lt;/h2>
&lt;h3 id="entering-command-mode">Entering Command Mode&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Command prompt&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>Ctrl+b :
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Common commands&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>:new-window
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>:kill-window
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>:split-window
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>:resize-pane
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="useful-commands">Useful Commands&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># List commands&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>:list-commands
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show key bindings&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>:list-keys
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Reload config&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>:source-file ~/.tmux.conf
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Show options&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>:show-options
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="configuration">Configuration&lt;/h2>
&lt;h3 id="basic-configuration-tmuxconf">Basic Configuration (~/.tmux.conf)&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Change prefix key&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g prefix C-a
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>unbind C-b
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind C-a send-prefix
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Enable mouse support&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g mouse on
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Start windows and panes at 1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g base-index &lt;span style="color:#a5d6ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>setw -g pane-base-index &lt;span style="color:#a5d6ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Renumber windows&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g renumber-windows on
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Increase history limit&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g history-limit &lt;span style="color:#a5d6ff">10000&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Enable vi mode&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>setw -g mode-keys vi
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Fast pane switching&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind -n M-Left &lt;span style="color:#ff7b72">select&lt;/span>-pane -L
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind -n M-Right &lt;span style="color:#ff7b72">select&lt;/span>-pane -R
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind -n M-Up &lt;span style="color:#ff7b72">select&lt;/span>-pane -U
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind -n M-Down &lt;span style="color:#ff7b72">select&lt;/span>-pane -D
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="status-bar-configuration">Status Bar Configuration&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Status bar&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g status-interval &lt;span style="color:#a5d6ff">1&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g status-justify centre
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g status-style &lt;span style="color:#79c0ff">bg&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>black,fg&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>white
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Status left&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g status-left-length &lt;span style="color:#a5d6ff">40&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g status-left &lt;span style="color:#a5d6ff">&amp;#39;#[fg=green]#S #[fg=blue]#I #[fg=cyan]#P&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Status right&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g status-right &lt;span style="color:#a5d6ff">&amp;#39;#[fg=cyan]%d %b %R&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Window status&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>setw -g window-status-style &lt;span style="color:#79c0ff">fg&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>cyan,bg&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>black
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>setw -g window-status-current-style &lt;span style="color:#79c0ff">fg&lt;/span>&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>white,bg&lt;span style="color:#ff7b72;font-weight:bold">=&lt;/span>red
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="key-bindings">Key Bindings&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Vim-style pane navigation&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind h &lt;span style="color:#ff7b72">select&lt;/span>-pane -L
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind j &lt;span style="color:#ff7b72">select&lt;/span>-pane -D
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind k &lt;span style="color:#ff7b72">select&lt;/span>-pane -U
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind l &lt;span style="color:#ff7b72">select&lt;/span>-pane -R
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Vim-style copy mode&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind-key -T copy-mode-vi &lt;span style="color:#a5d6ff">&amp;#39;v&amp;#39;&lt;/span> send -X begin-selection
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind-key -T copy-mode-vi &lt;span style="color:#a5d6ff">&amp;#39;y&amp;#39;&lt;/span> send -X copy-selection
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Better splitting&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind | split-window -h
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>bind - split-window -v
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="common-workflows">Common Workflows&lt;/h2>
&lt;h3 id="development-setup">Development Setup&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create development session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-session -d -s dev
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Split into multiple panes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux split-window -h
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux split-window -v
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux &lt;span style="color:#ff7b72">select&lt;/span>-pane -t &lt;span style="color:#a5d6ff">0&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux split-window -v
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run different commands in each pane&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux send-keys -t &lt;span style="color:#a5d6ff">0&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;vim&amp;#39;&lt;/span> Enter
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux send-keys -t &lt;span style="color:#a5d6ff">1&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;npm start&amp;#39;&lt;/span> Enter
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux send-keys -t &lt;span style="color:#a5d6ff">2&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;npm test&amp;#39;&lt;/span> Enter
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux send-keys -t &lt;span style="color:#a5d6ff">3&lt;/span> &lt;span style="color:#a5d6ff">&amp;#39;git status&amp;#39;&lt;/span> Enter
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Attach to session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux attach -t dev
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="remote-work">Remote Work&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create persistent session on remote server&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssh user@server
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-session -d -s remote-work
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Run long-running processes&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux send-keys &lt;span style="color:#a5d6ff">&amp;#39;python train_model.py&amp;#39;&lt;/span> Enter
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Detach and logout&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux detach
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>exit
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Later: reconnect and attach&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>ssh user@server
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux attach -t remote-work
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="advanced-features">Advanced Features&lt;/h2>
&lt;h3 id="session-scripting">Session Scripting&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-weight:bold;font-style:italic">#!/bin/bash
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-weight:bold;font-style:italic">&lt;/span>&lt;span style="color:#8b949e;font-style:italic"># Create development environment&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-session -d -s dev -x &lt;span style="color:#a5d6ff">120&lt;/span> -y &lt;span style="color:#a5d6ff">40&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Create windows&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-window -t dev:1 -n &lt;span style="color:#a5d6ff">&amp;#39;editor&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-window -t dev:2 -n &lt;span style="color:#a5d6ff">&amp;#39;server&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux new-window -t dev:3 -n &lt;span style="color:#a5d6ff">&amp;#39;tests&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Setup editor window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux send-keys -t dev:1 &lt;span style="color:#a5d6ff">&amp;#39;cd ~/project &amp;amp;&amp;amp; vim&amp;#39;&lt;/span> Enter
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Setup server window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux send-keys -t dev:2 &lt;span style="color:#a5d6ff">&amp;#39;cd ~/project &amp;amp;&amp;amp; npm start&amp;#39;&lt;/span> Enter
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Setup tests window&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux send-keys -t dev:3 &lt;span style="color:#a5d6ff">&amp;#39;cd ~/project&amp;#39;&lt;/span> Enter
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Attach to session&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>tmux attach -t dev
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="plugins-tpm">Plugins (TPM)&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Install TPM (Tmux Plugin Manager)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Add to ~/.tmux.conf&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g @plugin &lt;span style="color:#a5d6ff">&amp;#39;tmux-plugins/tpm&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g @plugin &lt;span style="color:#a5d6ff">&amp;#39;tmux-plugins/tmux-sensible&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>set -g @plugin &lt;span style="color:#a5d6ff">&amp;#39;tmux-plugins/tmux-resurrect&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Initialize TPM&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>run &lt;span style="color:#a5d6ff">&amp;#39;~/.tmux/plugins/tpm/tpm&amp;#39;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Install plugins: Ctrl+b I&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Update plugins: Ctrl+b U&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="troubleshooting">Troubleshooting&lt;/h2>
&lt;h3 id="common-issues">Common Issues&lt;/h3>
&lt;p>&lt;strong>Prefix key not working&lt;/strong>&lt;/p></description></item><item><title>Vim</title><link>http://qref.eknath.dev/tools/vim/</link><pubDate>Sun, 01 Jan 2023 00:00:00 +0000</pubDate><guid>http://qref.eknath.dev/tools/vim/</guid><description>&lt;h2 id="overview">Overview&lt;/h2>
&lt;p>Vim is a highly configurable text editor built to make creating and changing text very efficient. It&amp;rsquo;s an improved version of the vi editor with additional features like syntax highlighting, plugin system, and extensive customization options.&lt;/p>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#e6edf3;background-color:#0d1117;-moz-tab-size:2;-o-tab-size:2;tab-size:2;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Ubuntu/Debian&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo apt install vim
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># macOS&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install vim
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># or use MacVim for GUI&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install --cask macvim
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># CentOS/RHEL&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo yum install vim
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#8b949e;font-style:italic"># Arch Linux&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo pacman -S vim
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="basic-concepts">Basic Concepts&lt;/h2>
&lt;h3 id="modal-editing">Modal Editing&lt;/h3>
&lt;p>Vim operates in different modes:&lt;/p></description></item></channel></rss>