<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>rsync linux Archives - CNERIS</title>
	<atom:link href="https://cneris.com/en/tag/rsync-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://cneris.com/en/tag/rsync-linux/</link>
	<description></description>
	<lastBuildDate>Sun, 25 Aug 2024 20:25:23 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>Complete Manual for Using rsync in Linux</title>
		<link>https://cneris.com/en/complete-manual-for-using-rsync-in-linux/</link>
					<comments>https://cneris.com/en/complete-manual-for-using-rsync-in-linux/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 25 Aug 2024 20:25:23 +0000</pubDate>
				<category><![CDATA[Centos]]></category>
		<category><![CDATA[Dedicated servers]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[rsync linux]]></category>
		<category><![CDATA[ssh with rsync]]></category>
		<category><![CDATA[synchronization linux]]></category>
		<guid isPermaLink="false">https://cneris.com/?p=2150</guid>

					<description><![CDATA[<p>rsync is a powerful file synchronization and transfer tool used in Linux systems. It allows copying and synchronizing files and directories between different locations, either locally or between remote systems. Below is a step-by-step guide on how to use rsync with practical examples. 1. Installing rsync In most Linux distributions, rsync comes pre-installed. However, if [...]</p>
<p>The post <a href="https://cneris.com/en/complete-manual-for-using-rsync-in-linux/">Complete Manual for Using rsync in Linux</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><code>rsync</code> is a powerful file synchronization and transfer tool used in Linux systems. It allows copying and synchronizing files and directories between different locations, either locally or between remote systems. Below is a step-by-step guide on how to use <code>rsync</code> with practical examples.</p>
<p><strong>1. Installing <code>rsync</code></strong></p>
<p>In most Linux distributions, <code>rsync</code> comes pre-installed. However, if you need to install it, you can do so with the following command:</p>
<p>For Debian/Ubuntu-based systems:</p>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">sudo apt-get update<br />
sudo apt-get install rsync<br />
</code></div>
</div>
<p>For Red Hat/CentOS-based systems:</p>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="flex items-center relative text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md"></div>
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">sudo yum install rsync<br />
</code></div>
</div>
<p><strong>2. Basic Syntax of <code>rsync</code></strong></p>
<p>The basic syntax of <code>rsync</code> is as follows:</p>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">rsync [options] <span class="hljs-built_in">source</span> destination<br />
</code></div>
</div>
<ul>
<li><strong>source</strong>: The location of the file or directory you want to copy or synchronize.</li>
<li><strong>destination</strong>: The location where you want to copy or synchronize the files or directories.</li>
</ul>
<p><strong>3. Usage Examples</strong></p>
<ul>
<li><strong>Copy a file locally:</strong>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">rsync -avh /path/to/file.txt /path/to/destination/<br />
</code></div>
</div>
<ul>
<li><code>-a</code>: Archive mode; preserves permissions, modification times, and links.</li>
<li><code>-v</code>: Verbose mode; shows the progress of the transfer.</li>
<li><code>-h</code>: Human-readable; displays sizes in a readable format.</li>
</ul>
</li>
<li><strong>Synchronize a directory locally:</strong>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">rsync -avh /path/to/directory/ /path/to/destination/<br />
</code></div>
</div>
<p>Note: The trailing slash (<code>/</code>) at the end of the source directory is important. If omitted, <code>rsync</code> will create the source directory inside the destination directory.</li>
<li><strong>Synchronize files with a remote server:</strong>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">rsync -avh /path/to/directory/ user@remote_server:/path/to/destination/<br />
</code></div>
</div>
</li>
<li><strong>Synchronize files from a remote server to the local machine:</strong>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">rsync -avh user@remote_server:/path/to/directory/ /local/path/to/destination/<br />
</code></div>
</div>
</li>
</ul>
<p><strong>4. Common <code>rsync</code> Options</strong></p>
<ul>
<li><code>-z</code>: Compresses data during transfer to reduce bandwidth usage.</li>
<li><code>--delete</code>: Deletes files in the destination that are no longer present in the source.</li>
<li><code>-e ssh</code>: Uses SSH for data transfer, ensuring a secure connection.</li>
</ul>
<p><strong>5. Real-Time Synchronization</strong></p>
<p>If you want to synchronize continuously in real-time, you can use <code>rsync</code> in combination with <code>inotifywait</code>, a command that monitors file system changes.</p>
<p>Basic example:</p>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash"><span class="hljs-keyword">while</span> inotifywait -r -e modify,create,delete /path/to/directory; <span class="hljs-keyword">do</span><br />
    rsync -avz /path/to/directory/ user@remote_server:/path/to/destination/<br />
<span class="hljs-keyword">done</span><br />
</code></div>
</div>
<p><strong>6. Advanced Usage: Exclusions and Logs</strong></p>
<ul>
<li><strong>Exclude specific files or directories:</strong>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">rsync -avh --exclude <span class="hljs-string">'file_or_directory'</span> /path/to/directory/ /path/to/destination/<br />
</code></div>
</div>
</li>
<li><strong>Log the output to a log file:</strong>
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">rsync -avh /path/to/directory/ /path/to/destination/ --log-file=/path/to/logfile.log<br />
</code></div>
</div>
</li>
</ul>
<p><strong>7. Security Considerations</strong></p>
<ul>
<li><strong>Using SSH with <code>rsync</code>:</strong> To secure the transfer, it is recommended to use SSH.
<div class="dark bg-gray-950 rounded-md border-[0.5px] border-token-border-medium">
<div class="overflow-y-auto p-4" dir="ltr"><code class="!whitespace-pre hljs language-bash">rsync -avh -e ssh /path/to/directory/ user@remote_server:/path/to/destination/<br />
</code></div>
</div>
</li>
</ul>
<p><strong>8. Conclusion</strong></p>
<p><code>rsync</code> is a versatile and powerful tool for synchronizing and copying files on Linux. With this guide, you can start using <code>rsync</code> effectively for various tasks, from local copies to remote synchronization.</p>
<p>The post <a href="https://cneris.com/en/complete-manual-for-using-rsync-in-linux/">Complete Manual for Using rsync in Linux</a> appeared first on <a href="https://cneris.com/en">CNERIS</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cneris.com/en/complete-manual-for-using-rsync-in-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
