<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>porfirio's blog - zsh</title><link href="https://porfiriopaiz.github.io/site/" rel="alternate"/><link href="https://porfiriopaiz.github.io/site/feeds/zsh.atom.xml" rel="self"/><id>https://porfiriopaiz.github.io/site/</id><updated>2026-11-23T06:01:00-06:00</updated><entry><title>Syncing Files from macOS to Fedora Linux with rsync and SSH</title><link href="https://porfiriopaiz.github.io/site/posts/2026/11/23/syncing-files-macos-to-fedora-rsync-ssh.html" rel="alternate"/><published>2026-11-23T06:01:00-06:00</published><updated>2026-11-23T06:01:00-06:00</updated><author><name>Porfirio Páiz</name></author><id>tag:porfiriopaiz.github.io,2026-11-23:/site/posts/2026/11/23/syncing-files-macos-to-fedora-rsync-ssh.html</id><summary type="html">&lt;p class="first last"&gt;A complete guide on configuring rsync workflows from macOS to
Fedora Linux over SSH, covering short vs. long flags, global
exclusion lists, shell aliases, and SSH host key troubleshooting.&lt;/p&gt;
</summary><content type="html">&lt;p&gt;When transferring files between a macOS workstation (such as my MacBook Air
&lt;tt class="docutils literal"&gt;ankaa&lt;/tt&gt;) and a Fedora Linux machine (my Lenovo ThinkPad T450 &lt;tt class="docutils literal"&gt;taylor&lt;/tt&gt;),
&lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt; over SSH provides fast, incremental synchronization. Once the
&lt;tt class="docutils literal"&gt;taylor&lt;/tt&gt; host alias is configured in &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;~/.ssh/config&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt;
automatically inherits your target IP address (&lt;tt class="docutils literal"&gt;192.168.0.10&lt;/tt&gt;), username,
and custom identity key without requiring explicit connection flags on every
run.&lt;/p&gt;
&lt;hr class="docutils" /&gt;
&lt;div class="section" id="the-recommended-command-structure-short-flags"&gt;
&lt;h2&gt;The Recommended Command Structure (Short Flags)&lt;/h2&gt;
&lt;p&gt;The standard pattern for copying files from macOS to a remote Linux host
uses compact short options:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;-avzP&lt;span class="w"&gt; &lt;/span&gt;/path/to/local/source/&lt;span class="w"&gt; &lt;/span&gt;taylor:/path/to/remote/destination/
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="section" id="flag-breakdown-avzp"&gt;
&lt;h3&gt;Flag Breakdown (&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-avzP&lt;/span&gt;&lt;/tt&gt;)&lt;/h3&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;strong&gt;`-a` (archive mode):&lt;/strong&gt; Preserves file permissions, ownership,
timestamps, and symbolic links recursively.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;`-v` (verbose):&lt;/strong&gt; Displays which files are being transferred.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;`-z` (compress):&lt;/strong&gt; Compresses data in transit to speed up transfers
over Wi-Fi or LAN.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;`-P` (progress and partial):&lt;/strong&gt; Displays real-time progress bars and
retains partially transferred files to allow resuming interrupted
transfers.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="common-use-cases-and-trailing-slashes"&gt;
&lt;h3&gt;Common Use Cases and Trailing Slashes&lt;/h3&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Transferring a Single File:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;-avzP&lt;span class="w"&gt; &lt;/span&gt;~/Downloads/document.pdf&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Downloads/
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Transferring an Entire Folder:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Pay close attention to the trailing slash (&lt;tt class="docutils literal"&gt;/&lt;/tt&gt;) on the source directory:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Copy the contents of a directory into a target folder&lt;/strong&gt; (note the
trailing slash on &lt;tt class="docutils literal"&gt;Photos/&lt;/tt&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;-avzP&lt;span class="w"&gt; &lt;/span&gt;~/Photos/&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Pictures/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;em&gt;(Result: Files inside ``~/Photos/`` are placed directly inside
``~/Pictures/`` on ``taylor``).&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Copy the directory itself as a subdirectory&lt;/strong&gt; (no trailing slash on
&lt;tt class="docutils literal"&gt;Photos&lt;/tt&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;-avzP&lt;span class="w"&gt; &lt;/span&gt;~/Photos&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Pictures/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;em&gt;(Result: Creates ``~/Pictures/Photos/`` on ``taylor``).&lt;/em&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class="section" id="safe-verification-run-a-dry-run-first-n"&gt;
&lt;h3&gt;Safe Verification: Run a Dry Run First (&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-n&lt;/span&gt;&lt;/tt&gt;)&lt;/h3&gt;
&lt;p&gt;To preview which files will be copied or updated without modifying anything
on disk, pass the &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-n&lt;/span&gt;&lt;/tt&gt; (or &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--dry-run&lt;/span&gt;&lt;/tt&gt;) flag:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;-avzPn&lt;span class="w"&gt; &lt;/span&gt;~/Documents/&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Documents/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once you confirm the file list looks accurate, remove the &lt;tt class="docutils literal"&gt;n&lt;/tt&gt; flag to
perform the live transfer.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr class="docutils" /&gt;
&lt;div class="section" id="short-flags-vs-long-options"&gt;
&lt;h2&gt;Short Flags vs. Long Options&lt;/h2&gt;
&lt;p&gt;Short options (like &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-a&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-v&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-z&lt;/span&gt;&lt;/tt&gt;) are single-letter abbreviations
designed for quick terminal input. Long options (like &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--archive&lt;/span&gt;&lt;/tt&gt;,
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--verbose&lt;/span&gt;&lt;/tt&gt;, &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--compress&lt;/span&gt;&lt;/tt&gt;) perform the exact same operations while
remaining self-documenting and easier to read in scripts and documentation.&lt;/p&gt;
&lt;table border="1" class="docutils"&gt;
&lt;colgroup&gt;
&lt;col width="14%" /&gt;
&lt;col width="29%" /&gt;
&lt;col width="57%" /&gt;
&lt;/colgroup&gt;
&lt;thead valign="bottom"&gt;
&lt;tr&gt;&lt;th class="head"&gt;Short Flag&lt;/th&gt;
&lt;th class="head"&gt;Equivalent Long Option&lt;/th&gt;
&lt;th class="head"&gt;What It Does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody valign="top"&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-a&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--archive&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Enables recursion and preserves permissions,
modification times, ownership, and symlinks.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-v&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--verbose&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Displays detailed information about which
files are being transferred.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-z&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--compress&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Compresses file data during network transit
to speed up transfer times over Wi-Fi.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-P&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--progress&lt;/span&gt;&lt;/tt&gt;
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--partial&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Combined shortcut: &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--progress&lt;/span&gt;&lt;/tt&gt; shows the
live bar; &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--partial&lt;/span&gt;&lt;/tt&gt; keeps incomplete
files if the connection breaks for resuming.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-n&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--dry-run&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Performs a trial run showing what would
change without transferring or modifying
any files.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-u&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--update&lt;/span&gt;&lt;/tt&gt;&lt;/td&gt;
&lt;td&gt;Skips files that are already newer on the
destination host (&lt;tt class="docutils literal"&gt;taylor&lt;/tt&gt;).&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;div class="section" id="what-update-adds-to-your-workflow"&gt;
&lt;h3&gt;What &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--update&lt;/span&gt;&lt;/tt&gt; Adds to Your Workflow&lt;/h3&gt;
&lt;p&gt;Adding &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--update&lt;/span&gt;&lt;/tt&gt; instructs &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt; to compare file timestamps across
both machines:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;If a file on &lt;tt class="docutils literal"&gt;taylor&lt;/tt&gt; is &lt;strong&gt;newer&lt;/strong&gt; than the corresponding file on your
Mac, &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt; will &lt;strong&gt;not&lt;/strong&gt; overwrite it.&lt;/li&gt;
&lt;li&gt;This prevents accidentally rolling back recent edits made directly on the
remote Linux workstation.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div class="section" id="recommended-command-structure-long-options"&gt;
&lt;h3&gt;Recommended Command Structure (Long Options)&lt;/h3&gt;
&lt;p&gt;Using explicit long options, the standard transfer syntax becomes:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;--archive&lt;span class="w"&gt; &lt;/span&gt;--verbose&lt;span class="w"&gt; &lt;/span&gt;--update&lt;span class="w"&gt; &lt;/span&gt;--compress&lt;span class="w"&gt; &lt;/span&gt;--progress&lt;span class="w"&gt; &lt;/span&gt;--partial&lt;span class="w"&gt; &lt;/span&gt;/path/to/local/source/&lt;span class="w"&gt; &lt;/span&gt;taylor:/path/to/remote/destination/
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="admonition note"&gt;
&lt;p class="first admonition-title"&gt;Note&lt;/p&gt;
&lt;p class="last"&gt;&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--compress&lt;/span&gt;&lt;/tt&gt; is optional over fast local networks, though still
recommended when transferring large text files, source code repositories,
or scripts.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="long-option-use-cases-and-dry-runs"&gt;
&lt;h3&gt;Long-Option Use Cases and Dry Runs&lt;/h3&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Transferring a Single File:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;--archive&lt;span class="w"&gt; &lt;/span&gt;--verbose&lt;span class="w"&gt; &lt;/span&gt;--update&lt;span class="w"&gt; &lt;/span&gt;--progress&lt;span class="w"&gt; &lt;/span&gt;--partial&lt;span class="w"&gt; &lt;/span&gt;~/Downloads/document.pdf&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Downloads/
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Transferring Directory Contents vs. Subdirectories:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Copy contents directly&lt;/strong&gt; (trailing slash on &lt;tt class="docutils literal"&gt;Photos/&lt;/tt&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;--archive&lt;span class="w"&gt; &lt;/span&gt;--verbose&lt;span class="w"&gt; &lt;/span&gt;--update&lt;span class="w"&gt; &lt;/span&gt;--compress&lt;span class="w"&gt; &lt;/span&gt;--progress&lt;span class="w"&gt; &lt;/span&gt;--partial&lt;span class="w"&gt; &lt;/span&gt;~/Photos/&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Pictures/
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Copy the directory itself&lt;/strong&gt; (no trailing slash on &lt;tt class="docutils literal"&gt;Photos&lt;/tt&gt;):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;--archive&lt;span class="w"&gt; &lt;/span&gt;--verbose&lt;span class="w"&gt; &lt;/span&gt;--update&lt;span class="w"&gt; &lt;/span&gt;--compress&lt;span class="w"&gt; &lt;/span&gt;--progress&lt;span class="w"&gt; &lt;/span&gt;--partial&lt;span class="w"&gt; &lt;/span&gt;~/Photos&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Pictures/
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Running a Dry Run with Long Options:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;--dry-run&lt;span class="w"&gt; &lt;/span&gt;--archive&lt;span class="w"&gt; &lt;/span&gt;--verbose&lt;span class="w"&gt; &lt;/span&gt;--update&lt;span class="w"&gt; &lt;/span&gt;--progress&lt;span class="w"&gt; &lt;/span&gt;--partial&lt;span class="w"&gt; &lt;/span&gt;~/Documents/&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Documents/
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr class="docutils" /&gt;
&lt;div class="section" id="filtering-macos-metadata-files"&gt;
&lt;h2&gt;Filtering macOS Metadata Files&lt;/h2&gt;
&lt;p&gt;macOS automatically generates hidden metadata files such as &lt;tt class="docutils literal"&gt;.DS_Store&lt;/tt&gt;
and &lt;tt class="docutils literal"&gt;.localized&lt;/tt&gt; that clutter Linux directories. You can exclude them
per command or configure a permanent global exclusion list.&lt;/p&gt;
&lt;div class="section" id="option-1-inline-exclusions-per-command"&gt;
&lt;h3&gt;Option 1: Inline Exclusions (Per-Command)&lt;/h3&gt;
&lt;p&gt;Pass individual &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--exclude&lt;/span&gt;&lt;/tt&gt; parameters directly to &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;--archive&lt;span class="w"&gt; &lt;/span&gt;--verbose&lt;span class="w"&gt; &lt;/span&gt;--update&lt;span class="w"&gt; &lt;/span&gt;--progress&lt;span class="w"&gt; &lt;/span&gt;--partial&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;--exclude&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;.DS_Store&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;--exclude&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;.localized&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;--exclude&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;._*&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;--exclude&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;.CFUserTextEncoding&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;~/Desktop/&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Desktop/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Common macOS metadata files to exclude include:&lt;/p&gt;
&lt;ul class="simple"&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;.DS_Store&lt;/tt&gt; (Finder folder display settings)&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;.localized&lt;/tt&gt; (system folder localization hints)&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;._*&lt;/tt&gt; (AppleDouble resource fork files created on non-HFS/APFS
volumes)&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;.CFUserTextEncoding&lt;/tt&gt; (user text encoding preferences)&lt;/li&gt;
&lt;li&gt;&lt;tt class="docutils literal"&gt;.Trashes&lt;/tt&gt; and &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;.Spotlight-V100&lt;/span&gt;&lt;/tt&gt; (system trash and Spotlight index
directories)&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="section" id="one-liner-with-zsh-brace-expansion"&gt;
&lt;h4&gt;One-Liner with Zsh Brace Expansion&lt;/h4&gt;
&lt;p&gt;Because macOS uses &lt;tt class="docutils literal"&gt;zsh&lt;/tt&gt; as its default shell, you can collapse multiple
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--exclude&lt;/span&gt;&lt;/tt&gt; flags into a single brace expansion one-liner:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;--archive&lt;span class="w"&gt; &lt;/span&gt;--verbose&lt;span class="w"&gt; &lt;/span&gt;--update&lt;span class="w"&gt; &lt;/span&gt;--progress&lt;span class="w"&gt; &lt;/span&gt;--partial&lt;span class="w"&gt; &lt;/span&gt;--exclude&lt;span class="o"&gt;={&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;.DS_Store&amp;#39;&lt;/span&gt;,&lt;span class="s1"&gt;&amp;#39;.localized&amp;#39;&lt;/span&gt;,&lt;span class="s1"&gt;&amp;#39;._*&amp;#39;&lt;/span&gt;,&lt;span class="s1"&gt;&amp;#39;.CFUserTextEncoding&amp;#39;&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;~/Desktop/&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Desktop/
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The shell expands &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;{...}&lt;/span&gt;&lt;/tt&gt; into separate &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;--exclude&lt;/span&gt;&lt;/tt&gt; arguments before
executing &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="section" id="option-2-permanent-global-exclusion-list-recommended"&gt;
&lt;h3&gt;Option 2: Permanent Global Exclusion List (Recommended)&lt;/h3&gt;
&lt;p&gt;To avoid typing exclusion flags repeatedly, define a global ignore file in
your home directory and alias &lt;tt class="docutils literal"&gt;rsync&lt;/tt&gt; in &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;~/.zshrc&lt;/span&gt;&lt;/tt&gt;.&lt;/p&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Create ``~/.rsync-exclude`` on macOS:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;lt;&amp;lt; &amp;#39;EOF&amp;#39; &amp;gt; ~/.rsync-exclude&lt;/span&gt;
&lt;span class="s"&gt;.DS_Store&lt;/span&gt;
&lt;span class="s"&gt;.localized&lt;/span&gt;
&lt;span class="s"&gt;._*&lt;/span&gt;
&lt;span class="s"&gt;.CFUserTextEncoding&lt;/span&gt;
&lt;span class="s"&gt;.Trashes&lt;/span&gt;
&lt;span class="s"&gt;.Spotlight-V100&lt;/span&gt;
&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Add an alias to ``~/.zshrc``:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Open &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;~/.zshrc&lt;/span&gt;&lt;/tt&gt; in your editor:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;nano&lt;span class="w"&gt; &lt;/span&gt;~/.zshrc
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Append the following line and save the file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;alias&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;rsync&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;rsync --exclude-from=&amp;quot;$HOME/.rsync-exclude&amp;quot;&amp;#39;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Reload your shell configuration:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="nb"&gt;source&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;~/.zshrc
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Run your standard sync command:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync&lt;span class="w"&gt; &lt;/span&gt;--archive&lt;span class="w"&gt; &lt;/span&gt;--verbose&lt;span class="w"&gt; &lt;/span&gt;--update&lt;span class="w"&gt; &lt;/span&gt;--progress&lt;span class="w"&gt; &lt;/span&gt;--partial&lt;span class="w"&gt; &lt;/span&gt;~/Desktop/&lt;span class="w"&gt; &lt;/span&gt;taylor:~/Desktop/
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div class="section" id="cleaning-up-existing-metadata-files-on-linux"&gt;
&lt;h3&gt;Cleaning Up Existing Metadata Files on Linux&lt;/h3&gt;
&lt;p&gt;If macOS metadata files were already synced to &lt;tt class="docutils literal"&gt;taylor&lt;/tt&gt; previously, you
can remove them remotely via SSH:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ssh&lt;span class="w"&gt; &lt;/span&gt;taylor&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;find ~/Desktop -name &amp;#39;.DS_Store&amp;#39; -o -name &amp;#39;.localized&amp;#39; -delete&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;hr class="docutils" /&gt;
&lt;div class="section" id="ssh-host-key-troubleshooting-and-connection-verification"&gt;
&lt;h2&gt;SSH Host Key Troubleshooting and Connection Verification&lt;/h2&gt;
&lt;p&gt;When reinstalling Fedora Linux on &lt;tt class="docutils literal"&gt;taylor&lt;/tt&gt; while retaining the same local
IP address (&lt;tt class="docutils literal"&gt;192.168.0.10&lt;/tt&gt;), SSH generates a new host key fingerprint.
Attempting to copy keys or connect from &lt;tt class="docutils literal"&gt;ankaa&lt;/tt&gt; will trigger a remote host
identification warning because the stored fingerprint in
&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;~/.ssh/known_hosts&lt;/span&gt;&lt;/tt&gt; no longer matches.&lt;/p&gt;
&lt;div class="section" id="step-1-remove-the-stale-host-key-entry"&gt;
&lt;h3&gt;Step 1: Remove the Stale Host Key Entry&lt;/h3&gt;
&lt;p&gt;Clear the old fingerprint for &lt;tt class="docutils literal"&gt;192.168.0.10&lt;/tt&gt; from &lt;tt class="docutils literal"&gt;ankaa&lt;/tt&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ssh-keygen&lt;span class="w"&gt; &lt;/span&gt;-R&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;192&lt;/span&gt;.168.0.10
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This removes the outdated entry from &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;~/.ssh/known_hosts&lt;/span&gt;&lt;/tt&gt; and saves a
backup copy of the previous file.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="step-2-copy-your-public-key-and-accept-the-new-fingerprint"&gt;
&lt;h3&gt;Step 2: Copy Your Public Key and Accept the New Fingerprint&lt;/h3&gt;
&lt;p&gt;Re-run &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;ssh-copy-id&lt;/span&gt;&lt;/tt&gt; using your custom-named public key:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ssh-copy-id&lt;span class="w"&gt; &lt;/span&gt;-i&lt;span class="w"&gt; &lt;/span&gt;~/.ssh/porfirio@ankaa.pub&lt;span class="w"&gt; &lt;/span&gt;porfirio@192.168.0.10
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Type &lt;tt class="docutils literal"&gt;yes&lt;/tt&gt; when prompted to trust the new host fingerprint, then enter
your Fedora password to install the public key on &lt;tt class="docutils literal"&gt;taylor&lt;/tt&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div class="section" id="step-3-configure-ssh-config-and-test-connections"&gt;
&lt;h3&gt;Step 3: Configure &lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;~/.ssh/config&lt;/span&gt;&lt;/tt&gt; and Test Connections&lt;/h3&gt;
&lt;p&gt;Ensure your SSH client configuration on &lt;tt class="docutils literal"&gt;ankaa&lt;/tt&gt; points to the private key
file (without the &lt;tt class="docutils literal"&gt;.pub&lt;/tt&gt; extension):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;nano&lt;span class="w"&gt; &lt;/span&gt;~/.ssh/config
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;Host taylor
    HostName 192.168.0.10
    User porfirio
    IdentityFile ~/.ssh/porfirio@ankaa
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Enforce strict permissions on the configuration file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;chmod&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;600&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;~/.ssh/config
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can now verify passwordless authentication using three methods:&lt;/p&gt;
&lt;ol class="arabic"&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Direct connection with explicit identity flag:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ssh&lt;span class="w"&gt; &lt;/span&gt;-i&lt;span class="w"&gt; &lt;/span&gt;~/.ssh/porfirio@ankaa&lt;span class="w"&gt; &lt;/span&gt;porfirio@192.168.0.10
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Non-interactive remote command execution:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ssh&lt;span class="w"&gt; &lt;/span&gt;-i&lt;span class="w"&gt; &lt;/span&gt;~/.ssh/porfirio@ankaa&lt;span class="w"&gt; &lt;/span&gt;porfirio@192.168.0.10&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;hostname; uptime&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p class="first"&gt;&lt;strong&gt;Alias-based connection:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ssh&lt;span class="w"&gt; &lt;/span&gt;taylor
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If SSH still prompts for a password, run the connection in verbose mode
(&lt;tt class="docutils literal"&gt;&lt;span class="pre"&gt;-v&lt;/span&gt;&lt;/tt&gt;) to inspect key negotiation:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;ssh&lt;span class="w"&gt; &lt;/span&gt;-v&lt;span class="w"&gt; &lt;/span&gt;-i&lt;span class="w"&gt; &lt;/span&gt;~/.ssh/porfirio@ankaa&lt;span class="w"&gt; &lt;/span&gt;porfirio@192.168.0.10
&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><category term="floss"/><category term="backup"/><category term="cli"/><category term="fedora"/><category term="linux"/><category term="macos"/><category term="rsync"/><category term="ssh"/><category term="zsh"/></entry></feed>