Linux/Mac Terminal Tutorial: How To Use The rsync Command - Sync Files Locally and Remotely
In this Linux/Mac terminal tutorial, we will be learning how to use the rsync command. The rsync command will allow you to sync file and directories on your local machine or even over a network between servers. This is a great tool for running back ups, for only copying diffs, or even for deploying segments of code. Let's get started.
VirtualBox Network with SSH: • How to Create a Networ...
Key-Based Authentication: • Linux/Mac Tutorial: SS...
Cron Jobs: • Linux/Mac Tutorial: Cr...
✅ Support My Channel Through Patreon:
/ coreyms
✅ Become a Channel Member:
/ @coreyms
✅ One-Time Contribution Through PayPal:
goo.gl/649HFY
✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot
✅ Corey's Public Amazon Wishlist
a.co/inIyro1
✅ Equipment I Use and Books I Recommend:
www.amazon.com/shop/coreyschafer
▶️ You Can Find Me On:
My Website - coreyms.com/
My Second Channel - / coreymschafer
Facebook - / coreymschafer
Twitter - / coreymschafer
Instagram - / coreymschafer
#Linux #Mac
Пікірлер: 182
right out of the gate, glad there's no stupid background music!
@RsZ789
4 жыл бұрын
And no 20 second annoying intro. Love it.
@Gobi-Wan
4 жыл бұрын
@@RsZ789 dont forget to like comment and subscribe!
One of the best rsync tutorials ever. Thank you.
@easyvideott7505
3 жыл бұрын
NO... this IS the best tutorial on rsync!
I really appreciate your approach -- everything you said was about rsync -- no rambling on an on. A short description up-front, then useful examples following a planned presentation. Informative and straightforward.
Wow, I'm a huge fan after viewing that. Been having a hard time understanding rsync, but love all your examples! Please keep adding videos like these!
Thank you so much. By far the best tutorial I have seen about rsync. Great job!
Very clear and I liked the illustration for --dry-run. I'm also in awe of your typing skills (almost 18 minutes and not one typo!). But I'd be careful of calling rsync a backup tool. While rsync makes a copy, proper backups should be versioned so that if you accidentally damaged a file a couple days ago, you can get a clean copy from the backup made three days ago. If you rsync nightly to a destination copy, the damaged version of the file would already be synced by the time you realized it was damaged. You can add versioning to rsync (and --link-dest=dir can make it very space-efficient on the backup host) but you need to add a process for maintaining versions. Basically, to get seven days of versioning, you should rsync to a rotating day-of-the-week destination folder. But just rsync'ing to a single destination folder (as shown here) would not be versioned and would not be a good substitute for proper (versioned) backups. But a great explanation of using rsync.
Fantastic video! Imagine the hours I could have saved doing drag and drop manual backups if I’d seen this before! The dry run is such a useful feature and gets rid of the ‘clenching’ anxiety when you’re not sure that your backup is going to do what you thought it might. Thank you.
For those who read comments, before watching: it is exactly the tutorial you were looking for: good vid quality, good English, good examples. Thank you, Corey Schafer!
I’ve never felt so excited about watching more videos, if your other videos are as well put together and informative and easy to understand as this I’m going make some popcorn and tea :) good work and thanks for information it will be very helpful.
this is a great tutorial... i really like how you emphasized the --delete option. That would be catastrophic in a moment where you're trying to improve efficiency. Thank you!
Perfect tutorial. You explained exactly what I needed to know.
After a long time, I am satisfied with what I have learned. So many things but you made it simple and easy to understand.
Have been trying to read about rsync since last few weeks with nothing to stick in my mind. Thanks for being crisp and clear.
Great tutorial! Much appreciated. I like your style. Direct, to the point, and accounting for all the things someone needs to understand who's new to this. A natural educator.
Excellent step by step rsync demonstration video from a simple way to a complex way. Very useful, thanks a lot, Loïc.
Awesome! I did my personal scripts and binding to specific shortcuts so I can sync some directories with just two or three keys. Thanks for the video it provides me with all the information that I still need to accomplish that.
One of the best explanatory video on rsync, the presentation was good and the commands are clearly visible
You just saved my day with this tutorial. Was fed up completely and thought of getting rid of rsync and implementing custom solution. This tutorial helped me realize my silly mistake and made my day.
Ok, so its now 23rd of September 2020 (Year of the Covid-19) and I am 100% not a Linux guy for sure, but I am getting there with this kind of help. I have just followed this tutorial for Ubuntu 20.04 and have to say, it is still very much current. Thanks Corey, I have subscribed and you will now be my no 1 go to for my tutorials, if you have what I am looking for. Superb examples all the way through. Oh, and this is the first review I have ever felt the need to give in all my time on youtube. thumbs up mate, thank you from the UK.
I have a lot of experience using rsync, and found some things to do around rsync that get around issues, especially to do with "big" files. How big is big is debatable, it depends on disk size, bandwidth, etc. Anyway... Firstly if a big file is moved from one location to another, as rsync (with the --delete option) does not search for every file to delete before copying files somewhere earlier in the tree, it is possible if the file is big enough that the big file is transferred and fills the source disk before it gets chance to go to the part of the tree to delete where the file used to be. Solution... Do a one time pass of purely deleting files before running the normal rsync, ie: rsync -av --delete --ignore-existing --existing SOURCE DESTINATION Secondly, if the connection is of great distance and data transfer rate is slow, it is possible the rsync TCP connection is dropped before it completes copying a big file. rsync will then delete the half copied file, and the next run suffers from the same issue, and the file never gets copied. Solution... Use --append-verify so that if a timeout occurs, the next run of rsync continues from where it left off. However --append-verify will not copy files of the same (or smaller) size, this can happen with a logfile that might change content and be the same size every run. Or with repodata XML files. Solution... Once the --append-verify run of rsync successfully completes, THEN run a normal rsync (without --append-verify) to ensure files that have different content or are smaller, get copied properly. However this runs into the problem of the file that needs to get copied is BIG and doesn't make it across and it's too easy to get into a situation where --append-verify is ok, but the final rsync is not ok, repeatedly, and a big file never gets copied. Solution... monitor this normal rsync (ie the one after the --append-verify) and if it fails delete the last file being copied on the destination system, and let the next run of this (say) cronjob start again and --append-verify will copy over the big file (in several steps). FYI: I recommend the use of --conntimeout and --timeout to make rsync timeout if the connection hangs or has trouble starting. You might want to put a "timeout" command to call rsync anyway, in case rsync gets into a hung state internally. Finally, this does not solve the issue of a timeout happening if the time it takes for the directory tree to be completely read is too long. rsync will half die, and it's difficult to see why. In that case, split the transfer into multiple sub directories trees, so the directory listing is not too big for rsync to end up timing out during startup.
Damn.... EXCELLENT tutorial. I'm speechless.
Hey mate, great video... subscribed! I will be checking the rest of the videos that you suggested. I started using rsync but now I understand it better. Great explanation! Cheers.
Thank you for these. A good place to start learning a command, because the man pages are convoluted and impossible to read, but with you, it's all pretty clear
Well, definitely this tutorial was exactly what I was looking for. It took me maybe half an hour to whatch it and write down the concepts, but I'm sure I won't forget your lessons. *Very* good ide to advice to be careful with the --delete flag. I'm looking to do bidireccional syncing and it seems like this is exactly the tool. Already liked your video. Thanks a lot!
Corey, I have been learning about coding and linux for the last three years, and I always come to your channel first to see if you have the content I am looking for. I just donated $20 through PayPal. I know it`s not much, but at least a small tolken of my appreciation. I just bought a Raspberry Pi and looking forward to your upcoming tutorials on this topic :)
@coreyms
5 жыл бұрын
Thanks!
thank you, I come back to this video to brush up the commands and their meanings :)
Awesome tutorial. Clear, direct, and very easy to follow.
Man, I had to do a hw assignment on rsync. This video literally answered all of the questions that i had. Thanks a lot.
Excellent description! Love the visual on the right.
Beautiful video! Great demonstration. Really showed me what I need to know to get rolling with it. Much appreciated
Wow. This video was so smooth. Great job buddy! (y)
Liked, Subscribed and thump Upped. Great video man. Keep it coming.
Quick tip for Mac OSX terminal users - when doing rsync (or scp for that matter), you can just drag folders for FROM and TO into your terminal to save time typing. So type your rsync command followed by a space, then drop your origin folder onto terminal and path will appear, (plus an unseen space) then drop your destination folder and enjoy.
Corey your videos have helped me a lot...especially the ones on Rundeck..Ty!
this is what we call a greaaat job ,thanks man ,i really appreciate this work
Wonderful presentation Corey!
Love your videos.. I need come back again, and again through time..
Thanks man, helped me understand rsync much better.
Excellent tutorial! I did not know about the --dry-run parameter. I also like to exclude some folder when I am backing up my PC. I use after the --dry-run: --exclude={/sys/*,/tmp/*}.
recently picked up an old nas and nas is new to me. the nas does have apps and one is a sync utility but it's confusing and over documented. Your video was crystal clear. Thank you.
Hey Corey I really like your videos, concise and quite in-depth, but I wish you included the --include and --exclude since they get quite confusing.
nice video, didnt feel it was 18min, very clear thx.
Very good rsync tutorial. Thank you.
Great video. Ditto to the comments made by someone that there is no background music. A lot of information presented quickly and clearly...
This helped out immensely. Thanks so much!
Awesome video tutorial. Thumb up and subscribed!
Great tutorial. Very helpful!
Fan !! Take a bow , what an explanation, helped to get a task done 😎🥂
Excellent video! Thank you!
Great tutorial Corey! Subbed
Very clear demonstration thank you
Nice presentation. I really understand this topic. Thank you.
Thank you. very useful to my migration process.
You have a gift sir thank you very much for your videos it was extremely useful
Crystal clear! Thanks!
Thank you for this awesome tutorial. 👍
Excellent tutorial! Thankyou!
Your videos are too good. Thank you.
such a great video good examples and everything important explained Thank you!
Thank you, this has helped me a lot.
Awesome video Corey thank you so much.
Quality tutorial! Thanks!
This is what i wanted ThankYou
One other option I like to use is --stats. This gives a summary of files/folders which have been created, deleted, modified, etc. along with some other info.
Wonderful video, thanks.
thanks! It is good explained, very useful
Great video ! The number of options for rsync could be quite intimidating. It should not discourage people from using it because it is a great tool. It is a good candidate for an alias with tailored defaults for specific scenarios.
the best teacher, as usual!
Very helpful! Thank you!
Great video. Thank you!
Very clear, thanks.
Wow!! Thank you so much!!
fantastic tutorial!
Thanks my project done ❤️
Thank you for this tutorial
Good job Bro ....Thanks a lot ..thanks
Don't forget to use the -X flag to preserve extended file attributes!!! "rsync -aXP" Also some GUI frontends / alternatives: FreeFileSync (www.freefilesync.org ), Unison (www.cis.upenn.edu/~bcpierce/unison/ ), Synkron (synkron.sourceforge.net ). Be aware that they don't preserve xattr though.
Best tutorial ever
Please make Java tutorials after this series. You have some of the most well explained content I have ever had the pleasure of watching. Keep it up!
Would love to see you explain rsync excludes
Thank you so much!!!!
VERY GOOD! > U got me back into [terminal] > now to re-learn how to colorize my terminal and all that stuff. Thanks again. #HHNET
This Video is Great !
Thanks for this video, really rsync is a great command and I have been using it a lot lately. If you could do a tutorial on linux networking commands then that would be of great help as well. Thanks.
wonderful video is possible .if I have a home folder with subfolders, in them there are different files. now I want to copy only the files in all folders to a destination folder.
Excellent 👍👍👍👍👍
Very useful
thank you very much
Great video!! Regarding entering the IP address is see, can I put the hostname instead?
Superb video. Just subscribed. Does rsync notice if the file sizes are different. For example, if I’ve added more photos into iPhoto. The file would be there b the size is different and copy it over?
Very nice tutorial. If you use the -z parameter to transfer a large sized file(in GBs after compression), when the next time it will run, whether rsync can detect the changes happened inside the compressed dir and sync only changes? Or every time it will sync the whole file compressed file?
Thank you very much for this detailed tutorial. However, I would like to ask how to use rsync between 2 servers to local machine..i.e a server that is accessed through DMZ to your local machine.
bruhh just lost my entire external drive to a MARS ransomware attack and I had no backups on my Pi. This is so helpful
hi Corey, thanks for your vid, you really helped me understand rsync. I'm new to linux and plan to moving (my server) from macOS to Linux. Most of apps/softwares now I've found the Linux version/solution, only leaving the backup solution unsolved. I love the time machine from macOS, it not only backup the files automatically, it also keeps version of the entire mirror. For example I can go back to the history of a file/folder hours/days/weeks earlier. I wonder if rsync do this? By watching your vid I now understand rsync can do archive copy with -a, but looks it only filters the file to copy, but what I want is to keep history versions of a file/folder, is it possible to go with rsync? Thanks.
Great Tutorial! I have learned very much! Q: If i made cron job on daily basis for rsync the directory. And in the directory there is lots of content which will take around 2-3 days to complete. But my cron job will run on daily basis. So will my server get crash or get load or anything will going wrong ?
Hi Corey, I appreciate your videos and find them very useful. However, can you use rsync to move only files that are older than x days to another server?
I heard about the legend Corey for Python and decided to check him out later now I'm here looking for Rsync to make backups offline and here we are on his channel and subscribed to him
Perfect.
Thanks for yet another tutorial! Deja vu 6:19 - 6:38 ^^
@coreyms
6 жыл бұрын
Whoops. Thanks for noticing that. Definitely an editing error. I listen to these multiple times before uploading them, but sometimes it all runs together and I still end up missing things like that.
@coreyms
6 жыл бұрын
I'm trying to use KZread's built-in trim tool to edit out the duplicate, but it's pretty rudimentary. Not sure if it will sound natural once it finishes with the edit, but we'll see.
@coreyms
6 жыл бұрын
Okay, that seems to have worked and the duplicate soundbite has been trimmed out. Thanks again for letting me know!
@SuperRunescap
6 жыл бұрын
No problem! ^^
@theobican5971
6 жыл бұрын
Corey Schafer B
Kind of reminds me of scp in a way. Great video!
@coreyms
6 жыл бұрын
Yes, it's similar. But it's a bit better for certain situations where you only want to sync the diffs, such as backing up large numbers of files or images.