I've heard rsync is a great tool. Can anyone recommend a good tutorial on how to use it and what to use it for?
Thanks
[SOLVED] A good rsync tutorial?
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
[SOLVED] A good rsync tutorial?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: A good rsync tutorial?
rsync
, although it can be used via its own rsync network protocol as well, should preferably be considered a fancy version of cp
. Frankly most that you need to know about is is contained inCode: Select all
rsync -av /path/to/source /desti/nation/
As to what you use this fancy
cp
for, then, is to do fancy copying. Which may for example include from or to via an SSH reachable destination simply asCode: Select all
rsync -av /path/to/source machine:/desti/nation/
--delete
in that command line. A good "tutorial" I could not recommend, but man rsync
is useful as to what its options do. You'll often not in fact need/want many --- but there are tons.Re: A good rsync tutorial?
Read the man pages and pay attention to include/excludes. The order you specify them matters.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
-
- Level 8
- Posts: 2300
- Joined: Sat Sep 17, 2016 6:40 pm
- Location: England
Re: A good rsync tutorial?
Not wishing to hijack this discussion, but the matter of trailing slashes is relevant to it. Despite reading many guides over the years I struggled to comprehend the use of trailing slashes when it comes restoring a Home backup using Grsync. I now believe, and hope, that the lack of a / at the end of the destination creates a Home folder; whereas a / at the end restores to the existing Home folder. Am I wrong?rene wrote: ⤴Wed Apr 21, 2021 5:39 am Something you should learn early on about its syntax is the issue concerning trailing slashes or not: an operand /path/name denotes the file or directory /path/name whereas /path/name/ denotes the content of directory /path/name. If it's not immediately clear why you want to know that already just keep it in mind.
Cliff Coggin
Re: A good rsync tutorial?
The first part of that seems about right, Specifically (and all of these first while assuming that the destination does not yet exist),
would create /home/cliff to be a copy of /data/backup/cliff in the same way that
would. That syntax however also immediately says/implies that the second part of what you said is not in and of itself correct, depending on the syntax for the source parameter. I.e.,
would create a directory /home/cliff/cliff (to be a copy of etc.). If you on the other hand say
then you restore the contents of /data/backup/cliff to an existing directory /home/cliff --- which is presumedly what you generally want.
Do correct me if I'm wrong but I believe that if you just always vocalise/translate an ending slash in the context of rsync as "the content of" that you're okay (although there are still annoying potential differences between the cases of an already existing and nonexisting destination parameter that I've also stumbled over at times).
Code: Select all
rsync -av /data/backup/cliff /home/cliff
Code: Select all
rsync -av /data/backup/cliff /home/
Code: Select all
rsync -av /data/backup/cliff /home/cliff/
Code: Select all
rsync -av /data/backup/cliff/ /home/cliff/
Do correct me if I'm wrong but I believe that if you just always vocalise/translate an ending slash in the context of rsync as "the content of" that you're okay (although there are still annoying potential differences between the cases of an already existing and nonexisting destination parameter that I've also stumbled over at times).
-
- Level 8
- Posts: 2300
- Joined: Sat Sep 17, 2016 6:40 pm
- Location: England
Re: A good rsync tutorial?
rsync is a great tool. a lot of backup software is based on it.
10 practical examples,
https://www.tecmint.com/rsync-local-rem ... -commands/
IMO a "must know" for anyone with more than one pc.
I use it often to send a file to (or get a file from) another computer (rather than using USB sticks)
To keep the command simple, I create a top level directory like ~/send , or ~/ship etc., and place what ever I want to send in it. Since I have the same user name on all machines, the command is very short.
Basically,
That's pretty easy.
Note the trailing slash, as mentioned, that's so you don't create another "level".
If you did have a different username on another machine you add username@ in front of the ip address.
10 practical examples,
https://www.tecmint.com/rsync-local-rem ... -commands/
IMO a "must know" for anyone with more than one pc.
I use it often to send a file to (or get a file from) another computer (rather than using USB sticks)
To keep the command simple, I create a top level directory like ~/send , or ~/ship etc., and place what ever I want to send in it. Since I have the same user name on all machines, the command is very short.
Basically,
rsync -ahv ~/send/ 192.xxx.x.xxx:~/send
That's pretty easy.
Note the trailing slash, as mentioned, that's so you don't create another "level".
If you did have a different username on another machine you add username@ in front of the ip address.
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
Re: A good rsync tutorial?
Thank you for all the interesting posts, including the examples. That will do for me